I am importing some tables from one SQL Server to another, every night and the table should have a DDMMYYYY
sufix at the destination. I could not think of a way to change the name during import process and thought of renaming it after import. I am stuck here too as I am not able to get SP_RENAME
to work in the format SP_RENAME 'TABLE_NAME' 'TABLE_NAME+DDMMYYYY'
.
相关问题
- sql execution latency when assign to a variable
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
- SQL to Parse a Key-Value String
相关文章
- Entity Framework 4.3.1 failing to create (/open) a
- Code for inserting data into SQL Server database u
- SQL Server 2008 Change Data Capture, who made the
- Delete Every Alternate Row in SQL
- Linux based PHP install connecting to MsSQL Server
- SQL Azure Reset autoincrement
- How do we alias a Sql Server instance name used in
- Is recursion good in SQL Server?
Well, first of all, it really sounds like you should be loading this tables on one table and use another column for storing the date. Nevertheless, you could use dynamic SQL for what you want:
Oh, and take a look at this link to read about dynamic SQL on SQL Server.
Execute this script in SQL Server Management Studio (
Ctrl+T
(Text Output),F5
(Execute)) to generate anotherT-SQL
script:Example output/script generated (
Message panel
):Now, execute this script (
Ctrl+C
,Ctrl+V
,F5
).