Kristen
Kristen

Reputation: 183

Changing a column name in SQL Server?

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!

Upvotes: 0

Views: 76

Answers (2)

Rick S
Rick S

Reputation: 6586

Try this:

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

OR

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

Upvotes: 1

skribe
skribe

Reputation: 3615

Try this..

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

Upvotes: 0

Related Questions