locked
Script generation not working in SQL Server Management Studio RRS feed

  • Question

  • Hi! I am trying to generate scripts for create / insert etc. by right clicking on a table in the object explorer of SQL Server Management Studio 2008. Nothing happens when this is done. I have been using the same machine and the same environment for almost 2 years and all of a sudden script generation is not working. I would greatly appreciate help in resolving this issue.

    Thanks in advance!

    Tuesday, November 12, 2013 1:05 AM

Answers

  • Hi AM_Gkp,

    Usually, you can create Transact-SQL scripts using the Generate SQL Server Scripts Wizard, or using Object Explorer. I recommend you can open the Generate SQL Server Scripts Wizard  and follow the steps in the wizard to script the database objects.

    The steps of opening the Generate SQL Server Scripts Wizard  is following.
    In Object Explorer, expand Databases, right-click a database, point to Tasks, and then click Generate Scripts.

    Thanks,
    Sofiya Li


    Sofiya Li
    TechNet Community Support

    • Marked as answer by AM_Gkp Thursday, November 14, 2013 2:48 AM
    Wednesday, November 13, 2013 8:04 AM

All replies

  • Hi,

    It looks like you are selecting the option "CLIPBOARD" and you don't see anything happening after that.

    There are different option available:

    Script Table as -> Create to, insert to -> options like 

    1. New query window - Select this if you want to open the generated script to open in ssms.

    2. Clipboard. Select this if you want this to copied to clip board so as you may paste that to some editor and save it for later use.

    3. File - Select this if you wish to save the generated script as file. You need to provide file name and location.

    4. Agent job - use this if you would like to schedule this.

    Hope this helps!!


    Regards, Vishal Srivastava

    • Proposed as answer by Sofiya Li Wednesday, November 13, 2013 7:53 AM
    • Unproposed as answer by AM_Gkp Thursday, November 14, 2013 2:36 AM
    Tuesday, November 12, 2013 9:55 PM
  • Do you have "ddladmin" listed in your security profile?  DDL stands for "data definition language" and you need access to that in order generate the types of scripts it sounds like you're looking for.  Can you tell me specifically what error message you're getting?

    BrainE

    Tuesday, November 12, 2013 10:17 PM
  • Hi AM_Gkp,

    Usually, you can create Transact-SQL scripts using the Generate SQL Server Scripts Wizard, or using Object Explorer. I recommend you can open the Generate SQL Server Scripts Wizard  and follow the steps in the wizard to script the database objects.

    The steps of opening the Generate SQL Server Scripts Wizard  is following.
    In Object Explorer, expand Databases, right-click a database, point to Tasks, and then click Generate Scripts.

    Thanks,
    Sofiya Li


    Sofiya Li
    TechNet Community Support

    • Marked as answer by AM_Gkp Thursday, November 14, 2013 2:48 AM
    Wednesday, November 13, 2013 8:04 AM
  • Thanks a lot for your response Vishal.

    The event sequence is

    Right Click on an object in Object Explorer -> Script Table as -> Create To -> (Nothing Happens After This)

    I used to get as mentioned in your post, but now nothing happens.

    Regards,


    • Edited by AM_Gkp Thursday, November 14, 2013 2:50 AM
    Thursday, November 14, 2013 2:36 AM
  • Thanks a lot for your response BrainE

    I do have the required security profile.

    Kindly go through my reponse to post by Vishal Srivastava for the problem I am facing.

    Thanks and Regards,


    • Edited by AM_Gkp Thursday, November 14, 2013 2:49 AM
    Thursday, November 14, 2013 2:42 AM
  • Thanks a lot for your response Sofiya Li

    The method proposed does work and is definitely an option.
    However it is a little cumbersome for scripting one object with an objective of recreating it with some modifications.
    The option of scripting an object from Object Explorer directly is a lot more efficient, at least for me.

    The problem I am facing could be a result of some corrupted file. But I have no idea how to go about identifying and repairing it.

    Thanks and Regards,


    • Edited by AM_Gkp Thursday, November 14, 2013 2:49 AM
    Thursday, November 14, 2013 2:48 AM