Tuesday, March 27, 2012

Create table script

Hi all,
Often when I post a query problem the replies ask that a create
table script is provided. Is there an easy way to do this on SQL 2000?
What if I don't want to include a whole table only certain fields?
Any pointers would be gratefully received.
M

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!You can generate a CREATE TABLE script automatically in Query Analyzer
(right-click on the table in the Object Browser) or in Enterprise Manager
(right-click on the database. All Tasks > Generate SQL Script).

Ideally, edit the script to just the columns relevant to your problem but
always include the primary key for each table. Include the foreign keys if
there's more than one table involved. Also include any check, unique and
nullability constraints on the relevant columns.

Often it helps if you can construct some sample data (post as INSERT
statements) to illustrate your problem and show the result you require based
on that sample data. Oh, and do test your script out before you post it :-)

See also: www.aspfaq.com/5006

--
David Portas
----
Please reply only to the newsgroup
--

No comments:

Post a Comment