Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate a schema from an existing database

I am using microsoft sql server management studio 2008 and I want create a brand new database with all the same qualities of my current database has, but without the data the my current database has.

For example the user.dbo has say 12 users in it with passwords and other information in it. I only want the outline of that database and not have the users.

Can someone give me the right path toward getting that outline and then applying it to a new database?

like image 921
keyerer Avatar asked Nov 15 '25 21:11

keyerer


2 Answers

  1. From the management studio right click the database you want to script. Select Tasks > Generate Scripts and follow the wizard from there.

  2. Then right click Databases and New Database to create a new database

  3. Then right click the new database and New Query, in this window past the content of step 1 and click menu Execute (or F5)

like image 162
Ralf de Kleine Avatar answered Nov 18 '25 14:11

Ralf de Kleine


You can follow these steps

Goto Database>Right Click on DataBase>All Tasks.Generate SQL Scripts> 1.Show All(under general Tab)>select Scripts what you want 2.Under Formatting Tab select required formatting scrips 3.Under Options TAb select Required Security scripts and Table scripts 4.Then just click Ok and In one Script only will be Having Database creation,Database Users,Tables,Stored Procedures,Indexes,PK,Fk,then we just need to run this Script on SQL Query Anlyzer where we wish to create New Empty Database

like image 29
Neelam Singh Avatar answered Nov 18 '25 12:11

Neelam Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!