How to Generate DDL Scripts(Create) from SQL Server Management Studio (SSMS) - SQL Server / TSQL Tutorial Part 17


We often need to get DDL( Data Definition Language) scripts for different objects such as tables, views and Stored Procedures etc.
Is it possible to generate Create Table statement for a table in SSMS?
If I need to generate Create statement for all the tables/view, Will SSMS let me do it?


Generate Script for Single Object:

SQL Server Management Studio ( SSMS) does provide the feature to script single or all objects. To generate DDL script for single object, You can right click on the object and then choose the statement you like to create. Let's say if we would like to generate create table statement for existing table, we will choose below options.

How to generate DDL script ( Create Table) for an object in SSMS - SQL Server Tutorial

How to Generate DDL Scripts for More than One Object:
This is also easy. You need to Right click on the Database in which the objects exists. Then go to Tasks and hit Generate Scripts.

How to generate scripts for multiple objects in SSMS - SQL Server Tutorial

In Next window, you will be able to choose the objects for which you would like to create script. 

Generate Scripts for all the objects in a Database by using SQL Server Management Studio ( SSMS)

The next window will ask you if you like to have the scripts open in new Query Window or you would like to save in a file. Sometime you have a lot of objects and those script might not fit in Query Window, you can always save to file and then use it when required.

How to script all tables/Views/Stored Procedures from a database in SQL Server

Once you hit Next, You will see the progress windows as shown below. Once done. You can hit Finish. 
SQL Server Management Studio- How to script all objects in SSMS


  1. Purchase international SIM cards in their place. One of these international roaming SIM cards is the best choice for calling home. Change your local SIM card if you share this sentiment and want to take advantage of the lowest international phone rates available. M2M Sim Card

  2. Guys, hello everyone, is there anyone here with experience in crypto investments? I wouldn't hurt advice in finding and choosing a crypto exchanger.

  3. Listen, it's cool that you thought about cryptocurrency and how it can be a great source of income. Many people, when they think about making money online, start gambling and betting, which I don’t understand at all. There are many options now, including advice to learn more about how to earn interest on crypto on hexn. It doesn't take much time, is easily combined with the main work and brings an excellent income.