Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Column Name

Status
Not open for further replies.

jmiller79

Programmer
Jul 13, 2004
48
US
How do i change the column name withouth changing any formats?


Thank You
 
You could change the name of the field via SQL Server Enterprise Manager (if you mean at the database level) ?
If you want to change the name of a field in the result set of a query then you can make use of Aliasing - i.e.
SELECT Field1 AS 'NewFieldName' FROM Table1

Hope that this helps.
Steve
 
You use sp_rename to rename a column.
Code:
EXECUTE sp_rename N'dbo.table.column', N'new_column', 'COLUMN'

Denny

--Anything is possible. All it takes is a little research. (Me)
 
Just remember if you change a column name all the code which refernces this column will need to change.

Questions about posting. See faq183-874
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top