Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rwfresh
Starting Member
1 Post |
Posted - 2009-06-19 : 17:32:50
|
| Hi All,I am working on a that has columns with names: name, type, userI am trying to rename these columns with T-SQL and haven't found a reliable way to do so because they are reserved. Using double quotes or brackets is not working?? Thanks for any and all help! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-20 : 02:32:31
|
use sp_renameEXEC sp_rename 'dbo.yourtable.name', 'New Name here', 'COLUMN';GO |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-06-22 : 15:36:51
|
You can rename the actual column as Visakh suggested. Or, you can do it at select time with a delimited identifier (using brackets) and an AS clause:SELECT [user] AS NewUser, [name] AS NewName ... Are you saying that using delimited identifiers are not working for you?PS make sure you have SET QUOTED_IDENTIFIER OFF |
 |
|
|
|
|
|