Generate create table SQL script for all tables in database
22,596
Solution 1
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.
Solution 2
Use a Visual Studio SQL Server Database Project as follows:
- Create a Visual Studio SQL Server Database Project.
From the Project Menu, select Import > Database ...
Right click on the project and click publish.
Author by
IgO
Updated on November 29, 2020Comments
-
IgO over 3 years
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?