[dba-SQLServer] Table Scripts

Arthur Fuller artful at rogers.com
Mon Jan 16 13:26:52 CST 2006


I'm not sure exactly what you need to do, but if you open Enterprise Manager
(2000) or SQL Management Studio (2005), expand the databases treenode and
then the Databases node, then right-click on the table of interest, you get
a menu (which varies slightly from 2000 to 2005, but in both cases includes
the ability to generate a DDL (Data Definition Language) script that can
create the table of interest.
At that point you have several options. You can do this repeatedly for
several tables, pasting the resultant scripts into your text editor and then
saving that text file to something.sql, then execute it from Query Analyzer
(2000) or New Query (2005). Using this copy-paste technique, you can build
up a script that will create as many tables as desired.
On the other hand, if you want ALL the tables in a given database, you might
want instead to create a copy of the database then nuke all its rows, so you
end up with all the check constraints, stored procedures, UDFs and so on,
but with no data.
There is even a road between these two. You could back up a current copy,
nuke all the user-specific rows and preserve the user-generic rows (i.e.
lookup tables consisting of city names, product categories, etc.).
It is very simple to generate table scripts (as outlined above). However, a
table script does not constitute a database script, which is why I sketched
the options above: they break down to a) some tables from the source
database; b) the whole source database but no data; and c) the whole
database with some data.
HTH,
Arthur

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Rose Balan
Sent: January 16, 2006 1:57 PM
To: dba-sqlserver at databaseadvisors.com
Subject: [dba-SQLServer] Table Scripts


I am new to SQL...

I have some doubt regarding table structure scrips...

using sp_helptext 'procedure name' I got the procedure scripT, I don't know
how to create the script for tables using system stored procedures.

Thanks and Regards
RWB
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list