1

Using Sql Server 2008 R2 (but I could possibly upgrade if required).

I want to generate scripts for the database structure as well as the data for a schema.

The Generate Scripts wizard does what I want but I need to be able to automate it (so needs to be called from T-SQL or alternatively external program).

How can I do this?

Wilhelm Kleu
  • 163
  • 1
  • 4

2 Answers2

0

I know that Red Gate SQL compare has a command line interface so you could write and schedule a batch file to generate the scripts. Details here

You could then use SQLcmd to execute the scripts.

James Anderson
  • 5,794
  • 2
  • 27
  • 43
0

Probably you want to try PowerShell scripting for this.

yahor
  • 131
  • 5