Connecting Tech Pros Worldwide Forums | Help | Site Map

Generating Script for a DataBase

Needs Regular Fix
 
Join Date: Jul 2006
Location: India,Hyderabad
Posts: 367
#1: Aug 11 '08
Hi friends

recently i have started working on SQLserver 2005 as DBA for my project .

when i tried to generate script for my Database i was confused to find two options for scripting in management studio.

1. cript DataBase as and 2. Tasks-->Generate Script..

what is the difference between these two options ,which is to be used mostly

i have done a lot of googling but dint get any actual reply .

hope some one can reply as soon as possible.

Thanks

deepuv04's Avatar
Expert
 
Join Date: Nov 2007
Posts: 202
#2: Aug 11 '08

re: Generating Script for a DataBase


Hi,
The first option Script Database as will generate the script at database level, means if you select created to option then it will generate script for create
database (a blank database).

The second option Generate Script is used to include database elements also such as Tables, Functions, Procedures, Rules.. You can specify various options in the wizard for creating the script and specify all or specific objects for script.


Thanks
Needs Regular Fix
 
Join Date: Jul 2006
Location: India,Hyderabad
Posts: 367
#3: Aug 11 '08

re: Generating Script for a DataBase


Quote:

Originally Posted by deepuv04

Hi,
The first option Script Database as will generate the script at database level, means if you select created to option then it will generate script for create
database (a blank database).

The second option Generate Script is used to include database elements also such as Tables, Functions, Procedures, Rules.. You can specify various options in the wizard for creating the script and specify all or specific objects for script.


Thanks

HI deepuv

Thanks for your reply,

i used second option for generating script and also checked select all objects in database option that occur in second pane .

but now the problem is when i run the script in another server i got the database and all its objects correctly but the foreign key relations ships are missing ,
is there any more options to select, in the third pane (Choose Scripts Option) is there any changes to be made for these script options .

Any help pleaase.

Thanks
deepuv04's Avatar
Expert
 
Join Date: Nov 2007
Posts: 202
#4: Aug 11 '08

re: Generating Script for a DataBase


Quote:

Originally Posted by nmsreddi

HI deepuv

Thanks for your reply,

i used second option for generating script and also checked select all objects in database option that occur in second pane .

but now the problem is when i run the script in another server i got the database and all its objects correctly but the foreign key relations ships are missing ,
is there any more options to select, in the third pane (Choose Scripts Option) is there any changes to be made for these script options .

Any help pleaase.

Thanks


Hi,
In the third pane, under Table/View Options set Script Foreign keys to true.

Thanks
Needs Regular Fix
 
Join Date: Jul 2006
Location: India,Hyderabad
Posts: 367
#5: Aug 11 '08

re: Generating Script for a DataBase


Quote:

Originally Posted by deepuv04

Hi,
In the third pane, under Table/View Options set Script Foreign keys to true.

Thanks

Ya got it ,

any way thanks for your reply
Reply