Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL generated script doesn't contain default value

Author  Topic 

KSmith3421
Starting Member

2 Posts

Posted - 2006-08-24 : 10:35:52
Hi.
I attempted to generate a sql script from our production database and use it to generate the tables for a testing database. I manually created a new database and then used Query Analyzer to run this generated script on the testing SQL Server. It created the tables and the structures like I had hoped for..but once I started using the testing database, I realized that the testing database didn't get generated exactly right. For example, a couple of tables have a default value...these default values were missing (I guess that is the only thing that I have found so far).

I am using SQL Server 8.0.
I right click the table, choose All Tasks, choose Generate SQL Scripts, choose "Script All Objects".

I then look at the script that is generated and I don't find the default values in the script.

I realize that I can manually perform this step...but I would rather do it with the script...

Any idea on what I am doing wrong that is preventing the structure from getting generated as an exact duplicate?

Thanks
Keith

nr
SQLTeam MVY

12543 Posts

Posted - 2006-08-24 : 10:42:52
After script all objects instead of clicking finish click on next and it will show you what is selected to script and allow you to change it.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-08-24 : 10:43:14
U may need to go to the "Options" tab and select the "Script primary keys ...." in "Table Scripting options"

Srinika
Go to Top of Page

KSmith3421
Starting Member

2 Posts

Posted - 2006-08-24 : 10:50:38
quote:
Originally posted by Srinika

U may need to go to the "Options" tab and select the "Script primary keys ...." in "Table Scripting options"

Srinika





This did the trick. THANK YOU VERY MUCH!!!
Keith Smith
Go to Top of Page
   

- Advertisement -