Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Script entire database SQL-Server

Is there a way I can get a scripting of all tables, procs, and other objects from a database? I know there's an option to script the database but it only gave me some sort of top level script, certainly not a script to create all tables, procs, udfs, .etc.

like image 929
PositiveGuy Avatar asked Jul 21 '09 23:07

PositiveGuy


People also ask

How do I script an entire SQL Server database?

In SQL Server Management Studio, expand Databases, and then locate the database that you want to script. Right-click the database, point to Script Database As, point to CREATE to, and then click File. Enter a file name, and then click Save. The core database container will be scripted.

How do I script a SQL database with all tables?

Generate Database Script in SQL Server Now right-click the database then Tasks->Generate scripts. After that a window will open. Select the database and always check "script all objects in the selected database". It will generate a script for all the tables, sp, views, functions and anything in that database.

How do I run a database script on a server?

Click Query > Connection > Connect to connect to the server that contains the database you want to access. Select the appropriate StarTeam Server database. Open the tuning script, by choosing File > Open > foldername\scriptname. Execute the script, by clicking the Execute button on the toolbar or by pressing F5.


1 Answers

From Management Studio Right-click on your database. Tasks -> Generate Scripts.

That should do it.

like image 136
Chris Brandsma Avatar answered Sep 22 '22 17:09

Chris Brandsma