views:

31

answers:

3

Problem: how to automate a Generate Scripts in SQL2008 Management Studio:

ie right click on database, Tasks, Generate Scripts

All Tables All Stored Procs

Create drop statements Don't use USE statement Generate data

This is a 20sec process to do by hand.. needs automating :-) I don't really want to code it in C# in SQL Server Management Objects (SMO).

Maybe I'll have to use AutoHotKey :-)

A: 

Use SMO - it's the right thing to do and you know it!

Will A
:-) He he.. right... I'll be looking at SMO tomorrow I guess then!
Dave
If only you could script scripting. :) Where's the sp_generatescriptforobjects stored procedure when you need it? Enjoy!
Will A
A: 

Have a look at DBSourceTools. http://dbsourcetools.codeplex.com
It's an open-source scripting engine for SQL Server Databases that uses SMO.

blorkfish
A: 

I've taken Will A's advice and tried scripting.. http://stackoverflow.com/questions/3384649/sql-server-management-objects

nearly there :-)

Dave