Can you please advise on how to write this code properly:
declare @str nvarchar(50)
Set @str = '[table1].[column_name1]'
sp_RENAME @str, 'column2', 'COLUMN'
It currently gives an error
Incorrect syntax near 'sp_RENAME'
This should be equivalent with:
sp_RENAME '[table1].[column1]', '[column2]', COLUMN
that is used to rename a column from a table.
I need to use the first method because this happens as a general step in a procedure.
Thanks a lot!
EXECwhen calling stored procedures. The lazier syntax you're using is eligible for the first statement in the batch, but not later.sp_somethingis definitely lazier thanEXEC sp_something, no?