Skip to content
February 6, 2008 / kiranpatils

Generate Scripts from Database+SQL SERVER 2005

Hi.. yesterday one of my colleague has asked me that how can i generate a script from Database with A Relationship,Tables and all the stuff….and i have shown it may you need it tomorrow..


Want to generate a Script from  Database with all the Relationship,Tables…etc..


Just follow me:

1. I guess that you have opened Management studio and ready with Database.

2. just Right click on your database.

3. Will popup a  context menu. Select “Script Database as”->”Create to->New Query Editor Window [you can select anyone of it nothing strict in it :)].

It will generate a Script for Creating a Database. Now let’s see how can we create Script for Tables and all the stuff

4. Now, Right click on Database->Tasks->Generate Scripts.

5.follow a Wizard..[By clicking Next..Next] .

5.1. select database


5.3. select Object types you need [Table,SP,Views]

5.4 Choose SP [better do Select All].

5.5. Choose Tables.

5.6. Select Script mode..which is keep it on you for braveity.

5.7 Now make one file of both of this scripts and make it one [TOTAL SCRIPT=DATABSE SCRIPT+TABLE,SP,VIEWS SCRIPT]

5.8 That’s it now distribute. it to your client.. and enjoy!!!

6. How to generate  a database from Script file which was earlier generated.

6.1 Just open generated file in new query editor window.

6.2 Press F5 [to run script] .

6.3 That’s it.

you will have Database with all the stuff..

Happy Database Scripting!!!

-Kiran Patil



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: