Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In SQL Server 2008 it is possible to script data from SQL Server Management Studio.

I would like to make a job, that scripts everything in my database (tables, stored procedures etc) to one file and all data in some tables to another.

Is it possible - and what is the easiest way to do it?

The reason why I want this is so I can put my development databases under source control.

share|improve this question

Right click on the database, and select Tasks, then Generate Script. In the wizard on the options page, change Script Data from false to true.

share|improve this answer
That is not what I asked. I want to automate it, so I can run it in a scheduler that does what you just described. – Kjensen Aug 25 '09 at 22:48
There's no native way to script out the database or the data. I'm not sure if the their party tools can be scheduled to do this either. – mrdenny Aug 26 '09 at 1:13
up vote 0 down vote accepted

ScriptDb from Elsasoft does this. It is an open source commandline app from Elsasoft.

share|improve this answer
Updated version is over at codeplex now: – Scott Whigham Sep 8 '09 at 14:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.