Append SQL table name with today's date
Posted
by Ricardo Deano
on Stack Overflow
See other posts from Stack Overflow
or by Ricardo Deano
Published on 2010-04-07T12:49:45Z
Indexed on
2010/04/07
12:53 UTC
Read the original article
Hit count: 333
sql
Hello all.
I understand that I can change a sql table using the follow sp:
EXEC sp_rename 'customers', 'custs'
How would I go about appending this so that the new table has today's date as a suffix?
I've attempt variations on the below theme with little success!!
EXEC sp_rename 'customers', 'customers +(CONVERT(VARCHAR(8),GETDATE(),3))'
Any help greatly appreciated.
© Stack Overflow or respective owner