SQL Server Performance

Script Objects in SQL 2005

Discussion in 'SQL Server 2005 General Developer Questions' started by Akthar, Sep 21, 2006.

  1. Akthar New Member

    Hi Guys,

    1.Does SQL 2005 enables scripting of tables with triggers, indexes,etc ,like in Sql 2000?


    AKTHAR
  2. dineshasanka Moderator

    yes.
    I had a issue yesterday when i want to script triggers only which was not possible. may be i am wrong

    ----------------------------------------
    Contributing Editor, Writer & Forums Moderator
    http://www.SQL-Server-Performance.Com

  3. Twan New Member

    WHy can't you script triggers? Just find the table that has the trigger, expand it to show the list of triggers on that table, right-click and choose the Script Trigger As menu...

    Unless you're looking at Database Triggers which are triggers on DDL statements which are new to 2k5, but can still be scripted

    Cheers
    Twan
  4. dineshasanka Moderator

    Twan,I was looking to script trigger without table scripts which was not possible

    ----------------------------------------
    Contributing Editor, Writer & Forums Moderator
    http://www.SQL-Server-Performance.Com

  5. FrankKalis Moderator

    quote:Originally posted by dineshasanka

    Twan,I was looking to script trigger without table scripts which was not possible

    ----------------------------------------
    Contributing Editor, Writer & Forums Moderator
    http://www.SQL-Server-Performance.Com


    ...and does not make sense.
    however, you can script it, and use a text editor to remove the table DDL.
    --
    Frank Kalis
    Moderator
    Microsoft SQL Server MVP
    Webmaster:http://www.insidesql.de
  6. Twan New Member

    I don't get any table DDL?

    In the Object Explorer, I find my table, expand it, expand triggers, right-click the trigger I want, choose
    Script Trigger as, Create To, New Query Editor Window

    and I get just the trigger without any table ddl?

    Cheers
    Twan
  7. dineshasanka Moderator

    quote:Originally posted by Twan

    In the Object Explorer, I find my table, expand it, expand triggers, right-click the trigger I want, choose
    Script Trigger as, Create To, New Query Editor Window

    and I get just the trigger without any table ddl?


    That will work. but if I want to script all the triggers in the database, then there is no way. but in SQL Server 2000 , you can do this

    ----------------------------------------
    Contributing Editor, Writer & Forums Moderator
    http://www.SQL-Server-Performance.Com

  8. Akthar New Member

    yes dinesh is right , it is no more possible to script the table with all contains objects(triggers, indexex, etc)



    AKTHAR
  9. Twan New Member

    ah, I see said the blind man <img src='/community/emoticons/emotion-5.gif' alt=';-)' /><br /><br />Cheers<br />Twan
  10. hrishi_des New Member

    Right CLick on your database Task-> Generate Script and select your table and generate script

    quote:Originally posted by Akthar

    Hi Guys,

    1.Does SQL 2005 enables scripting of tables with triggers, indexes,etc ,like in Sql 2000?


    AKTHAR
  11. DilliGrg Member


    Also, I can't seem to figure out saving scripted files individually like we can do in 2000. It doesn't give any option whether we want to save as individual file intead of one file for all objects. I might be wrong. [:I]
  12. jezemine New Member

    A console app I wrote (scriptdb.exe) may be of some use to you. It will generate scripts for every object in your database, including triggers. I use it mainly for getting databases into source control that aren't already.

    The source code is available so it would be easy for you to modify it to meet your needs.

    you can get it here:http://www.elsasoft.org/tools.htm

    SqlSpec - a fast, cheap, and comprehensive data dictionary generator
    for SQL Server 2000 and 2005 and Analysis Server 2005 - www.elsasoft.org
  13. gforce New Member

    Hi Akhtar,
    you can script anything in database. including trigger and index but you have to right click database--->Task ----> generate script then you have to chhose what you wan tto script. Triggers are not scripted by default but you can turn this value on. This will script it for you ..
    Now second case is little different. i think thats where you pointing at. if you right click table and script it it will not script trigger or index rather it will only script table schema and extended SPs. I don't know why Microsoft did this. this sucks [:mad:]. but alternate is alway there as i mention above.
  14. Akthar New Member

    hi, gforce
    What do you mean by turning the value on. Where do you do it???
  15. DilliGrg Member

    You are pulling the OLD forum topic. Good way to increase the post...[;)]
  16. michellea_southern New Member

  17. satya Moderator

    Whats the point in scrubbing the old thread when the originator and other posters with similar problems hasn't been active on this one.
    Appreciate your effort for such a good reference.

Share This Page