在SQL Server中更改列名?

时间:2022-10-05 10:35:48

I am trying to change the column name of a temp table. Other posts have suggested the format should be as follows, but it is not working. Any tips would be appreciated.

我试图更改临时表的列名称。其他帖子建议格式应如下,但不起作用。任何提示将不胜感激。

SP_rename '#subscriptions.PricePerSeat', 'PricePerSeat_original', 'Column'

Thanks!

2 个解决方案

#1


1  

Try this:

USE TEMPDB
Exec SP_rename '#subscriptions.PricePerSeat', 'PricePerSeat_original', 'COLUMN'

OR

Exec tempdb..SP_rename '#subscriptions.PricePerSeat', 'PricePerSeat_original', 'COLUMN' 

#2


0  

Try this..

EXEC sp_RENAME '#subscriptions.PricePerSeat', 'PricePerSeat_original', 'COLUMN'

#1


1  

Try this:

USE TEMPDB
Exec SP_rename '#subscriptions.PricePerSeat', 'PricePerSeat_original', 'COLUMN'

OR

Exec tempdb..SP_rename '#subscriptions.PricePerSeat', 'PricePerSeat_original', 'COLUMN' 

#2


0  

Try this..

EXEC sp_RENAME '#subscriptions.PricePerSeat', 'PricePerSeat_original', 'COLUMN'