Reputation: 133
I need to create the SQL code that in its output will return the CREATE TABLE SQL for all tables in current database.
Any suggestions?
Upvotes: 12
Views: 31193
Reputation: 27201
Use a Visual Studio SQL Server Database Project as follows:
From the Project Menu, select Import > Database ...
Right click on the project and click publish.
Upvotes: 0
Reputation: 77846
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.
Upvotes: 36