Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bulk copy database tables
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Database management
Title:
Bulk copy database tables
Miscellaneous
Thread ID:
01132649
Message ID:
01132649
Views:
56
I want to be able to bulk copy all the tables in the database and rename them at the same time. I currently have code that finds all the tables in a database, loops through and does this:

EXECUTE ('SELECT * INTO x_' + @tablename + ' FROM ' + @tablename)

Whilst this works ok, I have 2 problems.

1) Takes a long time
2) Fills up transaction logs.

Is there a way that could do it quicker and/or not do any logging?

I also want to copy all the tables in 1 database into a newly created database but rename the tables at the same time. Is this possible using Stored Procedures?

Many Thanks
Next
Reply
Map
View

Click here to load this message in the networking platform