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
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Script all table contraints, indexes, keys, trigge

Author  Topic 

rama108
Posting Yak Master

115 Posts

Posted - 2012-03-21 : 09:41:35
Hi all,
Is there a way to script all tables contraints, indexes, keys and triggers for a database?

Thanks.

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-21 : 09:45:21
yes...

Right Click on the database

Choose Tasks>Generate Scripts

Then make sure you select the advanced option to script out all of the indexes as well

Save to a new query window


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

rama108
Posting Yak Master

115 Posts

Posted - 2012-03-21 : 09:50:25
The is no advanced option button there. I right-click on database, then click on task,generate scripts. Where is the advanced option button?
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-21 : 10:40:21
It's oin the setting scripting options dialog...where it say "save to file" You want to change that to save to new query window

The advanced button is on the upper left RIGHT hand of the dialog

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

rama108
Posting Yak Master

115 Posts

Posted - 2012-03-21 : 10:49:26
Found it. Thanks.
Go to Top of Page
   

- Advertisement -