|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Wednesday, February 17, 2010 12:47 PM
Points: 11,
Visits: 109
|
|
Hi.
I'm working on a script that moves data from one table to another (This one is created dynamic).
I'm using:
USE ping_statistics GO SELECT * INTO PING_Temp FROM Hostbackup EXEC sp_rename 'PING_Temp', 'HostInfo_(getdate)'
Where I would like the name of the new table to be
"PING_2008" Where 2008 is the current year.
Can anyone help me here?
\Jan.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 4:49 AM
Points: 1,075,
Visits: 5,119
|
|
declare @TableName char(50) select @TableName = 'PING_' + left(convert(char(50), getdate(), 120), 4) print @TableName execute sp_rename 'PING', @TableName
|
|
|
|