CREATE TABLE table_name AS SELECT STATEMENT WHERE rownum = 0;
this query will copy the table structure of one table without copying the data. I need to copy the table structures of all the tables in a particular database without copying the data.
suggest me on this.any body from microsoft|||gee I almost worked for microsoft. is that good enough?
in SQL2k, right click on your database in the Enterprise Mangler and choose Generate SQL script.|||rownum = 0?
What version are you talking about|||SQL Server 2000|||SQL Server 2000
Are you running this statement in sql server 2000? I don't think so...
CREATE TABLE table_name AS SELECT STATEMENT WHERE rownum = 0;
Please check your requirement,
That will not work at all,but this will
SELECT TOP 0 * INTO NewTable FROM OldTable
well Thrasymachus has already given you the solution.|||You can try an app I wrote for this called scriptdb. It will create scripts for ALL objects, not just tables, a separate file for each.
the source is freely available so you can modify it to suit your needs if you know C#.
get it here: http://www.elsasoft.org/tools.htm
EDIT: and I used to be a dev on the ms sql team, but no longer. does that count? :)
Showing posts with label structures. Show all posts
Showing posts with label structures. Show all posts
Sunday, February 19, 2012
Friday, February 17, 2012
copy struture of tables without loosing data
HI
I need to copy the table structures from my production database to development database but not loose the data in developement. Is there a way to achive this by creating some scripts.
thanksYou want to copy some tables from your production environment to devleopment? If so have you tried DTS?|||In your approach, you need to prevent to re-create your tables, and you simply have to append the data. DTS is the most suitable tool, there are other ETL tools as well, and, not recommended, you can write your transformation process in a varity of languages.
I'd be glad to hear your approach.
I need to copy the table structures from my production database to development database but not loose the data in developement. Is there a way to achive this by creating some scripts.
thanksYou want to copy some tables from your production environment to devleopment? If so have you tried DTS?|||In your approach, you need to prevent to re-create your tables, and you simply have to append the data. DTS is the most suitable tool, there are other ETL tools as well, and, not recommended, you can write your transformation process in a varity of languages.
I'd be glad to hear your approach.
Subscribe to:
Posts (Atom)