Script SQL 2008 databases

  • Hi All

    I used SQLpubwiz to script all databases into a SQL file, when i tried to use the same script on 2008 , it throws me a version error.

    Is there any way i can use the same scripting on SQL 2008 and 2008R2, or is there any other new options that i can use to automate this process the samilar to the way by using SQL pub Wiz

    Thanks in advance for your help

    Regards

    Sujith

  • All databases, all objects, automatically through SQL Server Management Studio? Nope. You can't do that. Your options are, use a third party tool (check out the Red Gate Toolbelt for some excellent tools that can do what you're looking for) or you need to write some code. If this is something you're doing all the time, I'd suggest using PowerShell with SMO (SQL Server Management Objects). The script utility built into SMO is the same as the one called by SSMS (which can only do one database at a time).

    "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

  • Thanks Grant, I havent used powershell until now, is there any good place you recommand for me to start to get some sample scripts.

  • I have a few scripts on my blog, but if you really want to see stuff, you need to read Allen White's blog, Buck Woody's blog, Aaron Nelson's blog, and Sean McCown's blog. Those guys have done quite a bit more than I have. For a special focus on SMO, which you'll need for this, Allen White is the first place I'd go.

    "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

  • Thanks Grant, i will have a look 🙂

    Thanks a lot 🙂

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

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