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 |
|
mdelgado
Posting Yak Master
141 Posts |
Posted - 2002-08-02 : 18:09:42
|
| Hello all.I would like to execute the sp_rename proc to rename a table to a variable.i.e.declare @NewNameset @NewName = 'abc'exec sp_rename 'OldTable',@NewNameAny ideas? thanks... |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-08-02 : 18:32:56
|
| Some dynamic SQL:declare @NewName set @NewName = 'abc' exec ('sp_rename ''OldTable'',' + @NewName + '''')Should do the trick. Might need to play with the apostrophes though. |
 |
|
|
|
|
|