0

I'm trying to save the whole database to a query in sql server 2008. I have experience with mysql and phpmyadmin, and over there I used to have a simple button to save the database, including constraints and basically everything, to a simple query.

that query basically recreates the database i created just as it was. I think you guys understand what I mean.

is there such an option in ms sql server? thank you in advance.

icarus
  • 166
  • 1
  • 6
  • 14
  • May be you want to take a look at [this link](http://stackoverflow.com/questions/6799120/script-all-data-from-sql-server-database) – KrazzyNefarious Jan 08 '14 at 21:26
  • thank you, bhupeshc, this is exactly what I was looking for. I just wasn't searching it properly, never thought about 'scripting' the database. cheers. – icarus Jan 08 '14 at 21:30

2 Answers2

2

You can generate scripts to recreate the database structure in SSMS:

Right-click a database, choose Tasks > Generate Scripts... and go through the wizard.

You do not get insert scripts for all the data by default, you need to choose that in the Advanced options in the wizard, Types of data to script choose Schema and data/Data only/Schema only`

Hart CO
  • 34,064
  • 6
  • 48
  • 63
0

For SQL Server, I generally go with a backup/restore point of view. You can backup your entire database to a file, and then choose to restore that database (To another name as I often use for recreating new test databases).

I don't know about creating a query out of the database, but the effect of both seems to be the same result.