Showing posts with label generation. Show all posts
Showing posts with label generation. Show all posts

Monday, March 12, 2012

Script generation for Objects - Management Studio

How do I generate a single script for each object - table, view, index, trigger, sp, function etc.... in SQL Server. The script that is generated from SQL Server wizards is in a single file.

I want to have separate file for each of the objects.

In EM, you right-click on the object, select 'all tasks', then 'Generate SQL Script'. I do not have access to Management Studio right now, so this may or may not be much help.

Do you have access to Enterprise Manager? You can run SQL Server 2000 and 2005 side by side, so it may be worthwhile installing if you cannot do this in MS.

Clarity Consulting (http://www.claritycon.com)

|||

Well we have the same feature in SQL 2005 but I need one individual file for each object. I do not want the script of say all tables in file. I want this in different files with file name as table name that is getting scripted.

It applies to other objects like procs, funcs, triggers, constraints, FKs etc

|||You might look at Scriptio. I use it to create .sql files off of my db schema. On the 2nd tab I select ONE FILE PER OBJECT. www.sqlteam.com. The only problem I have found is that existing sql files (we re-exporting) can't be read-only.|||Currently, the Generate Script Wizard can only create a single file. We plan to implement file-per-object functionality in SP2.

Script generation for Objects - Management Studio

How do I generate a single script for each object - table, view, index, trigger, sp, function etc.... in SQL Server. The script that is generated from SQL Server wizards is in a single file.

I want to have separate file for each of the objects.

In EM, you right-click on the object, select 'all tasks', then 'Generate SQL Script'. I do not have access to Management Studio right now, so this may or may not be much help.

Do you have access to Enterprise Manager? You can run SQL Server 2000 and 2005 side by side, so it may be worthwhile installing if you cannot do this in MS.

Clarity Consulting (http://www.claritycon.com)

|||

Well we have the same feature in SQL 2005 but I need one individual file for each object. I do not want the script of say all tables in file. I want this in different files with file name as table name that is getting scripted.

It applies to other objects like procs, funcs, triggers, constraints, FKs etc

|||You might look at Scriptio. I use it to create .sql files off of my db schema. On the 2nd tab I select ONE FILE PER OBJECT. www.sqlteam.com. The only problem I have found is that existing sql files (we re-exporting) can't be read-only.|||Currently, the Generate Script Wizard can only create a single file. We plan to implement file-per-object functionality in SP2.

Script Generation

In SQL 2000 Enterprise Manager, you can create SQL scripts for
procedures by right clicking and choosing generate SQL script. It sets
some database defaults and turns some things on and off. Is there a
way to modify the things that are created to return more data? Is it
in a template where i can add some code. I want to include 1 line in
each script it generates but cant find where to do it. Can it be done?
How?
Thanks so much in adavnce!
-dL
Hi DL,
You can not customize that. Instead you can use SQL DMO to generate customized scripts.
See the below link:-
http://www.karaszi.com/sqlserver/inf...ate_script.asp
Thanks
Hari
SQL Server MVP
____________________________________
Sweet Daddy Coconut Wrote:
In SQL 2000 Enterprise Manager, you can create SQL scripts for
procedures by right clicking and choosing generate SQL script. It sets
some database defaults and turns some things on and off. Is there a
way to modify the things that are created to return more data? Is it
in a template where i can add some code. I want to include 1 line in
each script it generates but cant find where to do it. Can it be done?
How?
Thanks so much in adavnce!
-dL
Sent via SreeSharp NewsReader http://www.SreeSharp.com