Script Objects in SQL 2005 | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Script Objects in SQL 2005

Hi Guys, 1.Does SQL 2005 enables scripting of tables with triggers, indexes,etc ,like in Sql 2000?
AKTHAR
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
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
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
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
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
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
yes dinesh is right , it is no more possible to script the table with all contains objects(triggers, indexex, etc) AKTHAR
ah, I see said the blind man <img src=’/community/emoticons/emotion-5.gif’ alt=’;-)’ /><br /><br />Cheers<br />Twan
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


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]
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

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.

hi, gforce
What do you mean by turning the value on. Where do you do it???
You are pulling the OLD forum topic. Good way to increase the post…[;)]

Try scriptio. It is free software at http://www.sqlteam.com/publish/scriptio/
I just found it today and it is great.

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.

]]>