Ramblings of a DBA

Tara Kizer
posts - 166, comments - 837, trackbacks - 75

My Links

Advertisement

News

Subscribe
Search this Blog

Archives

Post Categories

Work

Generating SQL Scripts in SQL Server 2005

In SQL Server 2000, you could generate a SQL script easily using the Generate SQL Script wizard.  You could get to it from pretty much anywhere from within Enterprise Manager.  For instance, you can get to it by right clicking on any object in the database, then selecting All Tasks, and then selecting Generate SQL Script. 

In SQL Server 2005, it is now called Generate Scripts.  The only place that I can find where you can get to it is if you right click on the database, then selecting Tasks, and then selecting Generate Scripts.  The 2005 wizard does not resemble the 2000 wizard, so you have to use it a few times before you are comfortable with it. 

The most annoying thing with the new 2005 scripting wizard is that you can not generate both CREATE and DROP statements together like you could in the 2000 scripting wizard.  When you select the Script Behavior field, it indicates that this is possible.  However, it is not! Check this out:

Notice in the description that it says you can do either CREATE, DROP, or DROP followed by CREATE.  However, when you look at the dropdown options, only DROP or CREATE is available. 

I am running SQL Server 2005 service pack 1 already.  Let's hope they fix this in the next service pack.

Print | posted on Wednesday, September 20, 2006 4:47 PM | Filed Under [ SQL Server - General ]

Feedback

Gravatar

# re: Generating SQL Scripts in SQL Server 2005

I can right-click a table, sproc etc and in the popup menu I get a 'Script <object> as...' option. Still no drop then create option but a little more convenient that using the wizard each time.
9/20/2006 11:32 PM | Paul Wakeford
Gravatar

# re: Generating SQL Scripts in SQL Server 2005

Paul,

I agree with you that that option is more convenient, however it only allows you to script one object at a time. Typically, I've got to script a bunch of objects for deployment reasons.
9/21/2006 9:42 AM | Tara
Gravatar

# re: Generating SQL Scripts in SQL Server 2005

All those drop-down look harder to quickly select what you want than the old checkbox dialog boxes. Looks to be hard to see if you mis-select something in a hurry ... but there again I haven't used it, so maybe its more wonderful than it appears!
9/21/2006 11:55 AM | Kristen
Gravatar

# re: Generating SQL Scripts in SQL Server 2005

There is another way

Click the Jobs or Stored Procedures folder in SQL Server Management Studio, and then hit the F7 key; this will bring up the Summary pane. Highlight all the Jobs or Stored Procedures that you want to script using a combination of Shift and Ctrl keys, then right click, Script Job/Stored Procedure as..., and then choose where to save this script to
9/21/2006 2:49 PM | Denis the SQL Menace
Gravatar

# re: Generating SQL Scripts in SQL Server 2005

After many many complaints, it looks like it definitely will be back in the next SP. Until that time i've had to make a little app which emulates the old behaviour of sql2000.

If you're looking for a start, google "scriptio" and it should point to an app on this site.

I made my own because i needed it to be consistent with 2000 for source control purposes.
9/21/2006 6:32 PM | Chris
Gravatar

# Bitacle Blog Search Archive - Generating SQL Scripts in SQL Server 2005

[...] In SQL Server 2000, you could generate a SQL script easily using the Generate SQL Script wizard. [...]
9/22/2006 9:59 PM | bitacle.org
Gravatar

# re: Generating SQL Scripts in SQL Server 2005

MS People are always in a hurry to release patches & that makes them make these kind of silly mistakes :)
10/1/2006 9:26 AM |
Gravatar

# re: Generating SQL Scripts in SQL Server 2005

I'm more curious as to why on earth this basic feature was left out.

Who are these people developing the product - obviously not from the real world :(
10/10/2006 1:11 AM | Hefty
Gravatar

# re: Generating SQL Scripts in SQL Server 2005

I have done Generating the SQL Server 2005 script but my scripts has no data its only the table and views structure I got.

How could I get the table in my tables from SQL Server 2005 and import it to SQL Server 2000?

Any help?

10/26/2006 8:08 PM | Edwin
Gravatar

# re: Generating SQL Scripts in SQL Server 2005

I have the same problem. I can import the tables to 2000. But not like objects where the dependencies are also copied. they seem to have taken this feature out to. When you click on generate script for 2000 it doesn't work when you try to execute the script in SQL 2000. SQL 2005 sucks big time. What ever happened to DTS packages? replaced it with SISS.. doesn't help my cause.
11/2/2006 2:10 AM | David
Comments have been closed on this topic.

Powered by:
Powered By Subtext Powered By ASP.NET