Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate create table SQL script for all tables in database

I need to create the SQL code that in it's output will return the CREATE TABLE SQL for all tables in current database.

Any suggestions?

like image 752
IgO Avatar asked Sep 16 '15 11:09

IgO


2 Answers

In SQL Server Management Studio(SSMS)

Right click on the DB_NAME -> Select Task -> Select Generate Script.

Follow along the presented wizard and select all tables in that database to generate the scripts.

like image 152
Rahul Avatar answered Nov 03 '22 08:11

Rahul


Use a Visual Studio SQL Server Database Project as follows:

  1. Create a Visual Studio SQL Server Database Project.

enter image description here

  1. From the Project Menu, select Import > Database ...

  2. Right click on the project and click publish.

like image 39
Dale K Avatar answered Nov 03 '22 07:11

Dale K