Generating Script for a DataBase

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nmsreddi
    Contributor
    • Jul 2006
    • 366

    Generating Script for a DataBase

    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
    Recognized Expert New Member
    • Nov 2007
    • 227

    #2
    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

    Comment

    • nmsreddi
      Contributor
      • Jul 2006
      • 366

      #3
      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

      Comment

      • deepuv04
        Recognized Expert New Member
        • Nov 2007
        • 227

        #4
        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

        Comment

        • nmsreddi
          Contributor
          • Jul 2006
          • 366

          #5
          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

          Comment

          Working...