February 16, 2006 at 11:21 am
Does anyone know of a way looking up the names of all the user tables in a database and creating an indentical copy of the structure of each of those tables (eg, tblOrders copied to tblOrders_Copy) in one go without having to manually do each table individually?
Thanks.
February 16, 2006 at 11:26 am
Hello,
You can script the objects available currently and add up the word "_Copy" to the scripted objects and execute the same.
Thanks and have a nice day!!!
Lucky
February 16, 2006 at 11:27 am
Write SQL to generate SQL:
SELECT 'SELECT * INTO ' + name + '_Copy FROM ' + name + ' WHERE 0 = 1'
FROM sysobjects
WHERE type = 'U'
Take the output of that and run it.
February 16, 2006 at 1:46 pm
Thanks guys - that's done the trick!
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply