Scripting in SQL 2008?

  • Is scripting better in 2008 than it is in 2005? Hopefully more like the scripting capabilities in 2000?

    Every time I go to script something in 2005 it find myself engulfed in windows as you have to script so many thinngs individually and copy them to your original window if you want to have a single all-encompassing script for X object, such as if you want to check it into source code control.

    I do not have access to a SQL 2008 box at this time, which is why I ask.

    Thanks,

    Chris

    Learning something new on every visit to SSC. Hoping to pass it on to someone else.

  • I don't understand the question. Do you mean generating individual TSQL scripts through the GUI?

    2005 & 2008 are pretty much the same. Where are you hitting issues?

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • The individual objects, like when you need to duplicate a table real quick. Used to be simple to do with SQL 2000, you got the same window as if you were scripting the entire DB, but with only the selected objects, you could generate the drop in the same script.

    Supposedly much of this was fixed in SQL 2005 SP2, but in my testing I have not found this to be the case. While it scripts extended properties, it doesn't script the statistics or the drop, even though I have changed these item to be True in the scripting options.

    Another annoyance is the change from check boxes to list boxes for True/False. Gee, could they make it slower for us who like to use the GUI? Besides, that window should pop up any time we go to create a script, like SQL 2000, so we can choose what options we need for that particular script. I will say that being able to se the defaults for scripting is nice, if they actually worked.

    I also wish for the ability to be able to script ANYTHING in the DB. I should be able to right-click on an object in the DB and have a Generate Script menu-item.

    Thanks,

    Chris

    Learning something new on every visit to SSC. Hoping to pass it on to someone else.

  • Stamey (3/3/2009)


    The individual objects, like when you need to duplicate a table real quick. Used to be simple to do with SQL 2000, you got the same window as if you were scripting the entire DB, but with only the selected objects, you could generate the drop in the same script.

    Supposedly much of this was fixed in SQL 2005 SP2, but in my testing I have not found this to be the case.

    I'm not sure about 2005, I don't have that gui installed any more, but in 2008, I get a list of script options that includes a drop & create.

    While it scripts extended properties, it doesn't script the statistics or the drop, even though I have changed these item to be True in the scripting options.

    To my knowledge it will only generate statistics if they were manually created.

    Another annoyance is the change from check boxes to list boxes for True/False. Gee, could they make it slower for us who like to use the GUI? Besides, that window should pop up any time we go to create a script, like SQL 2000, so we can choose what options we need for that particular script. I will say that being able to se the defaults for scripting is nice, if they actually worked.

    Well, maybe things are better in '08. I don't generate tons of scripts manually, but the ones I have generated do seem to use the defaults I set.

    I also wish for the ability to be able to script ANYTHING in the DB. I should be able to right-click on an object in the DB and have a Generate Script menu-item.

    Thanks,

    Chris

    Again, this may be 2008, but you can right click on just about any object and generate a script. It might not be the formatted like you want, but you should be able to do that much. I didn't see any objects where I couldn't do it on a quick check through.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • are you right-clicking on the individual object such as a table, a stored proc etc, or on the database itself? If you right-click on the database and go to Tasks | Generate scripts you can script individual / multiple objects and include 'drop', 'if not exists' statements etc, which will all be in the single script that is generated

    Hope that helps - apologies if i have misunderstood your question 🙂

  • Also, I always forget about this, but you can use the object explorer details window. Click on, say tables in the object explorer window and you'll see the list of tables for the database in the object explorer details window. You can shift-click or control-click to select multiple object and then right click to get the scripting options.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply