0

I have 100 tables in 6 schema. I want to create DDL (create table) script for 25 tables belong to all 6 schema. All are in one database.

I am new to SSMS (SQL Server 2018). I know its easy in Oracle. I am not getting a way how to get exact DDL only for some tables.

Can someone provide the script if handy?

Dale K
  • 25,246
  • 15
  • 42
  • 71
Vikas
  • 5
  • 1
  • 6
  • There is no SQL Server **2018** - we have 2012, 2014, 2016, 2017 and 2019 - take your pick – marc_s Jun 08 '20 at 20:04
  • Does this answer your question? [How to generate scripts to recreate table using SQL Server Management Studio \[Schema and data\]?](https://stackoverflow.com/questions/13521085/how-to-generate-scripts-to-recreate-table-using-sql-server-management-studio-sc) – Dale K Jun 08 '20 at 20:36
  • No, It is not helping me. I want selected tables CREATE script. By the suggested option available in SSMS Generate Scripts , it is generating all the DB/Schema script. it is more manual task which i want to avoid. – Vikas Jun 08 '20 at 22:00

1 Answers1

1

Right click the database name in SSMS. Choose Tasks-> Generate Scripts. Click that you want to select only certain objects. Within the next dialog, there is an advanced button that allows you to script schema only, or schema and data both.

Robert Sievers
  • 1,277
  • 10
  • 15
  • I did that by seeing other post on this. But the after click on Generate Scripts. It is taking hell lot of time. – Vikas Jun 08 '20 at 20:12
  • No, It is not helping me. I want selected tables CREATE script. By the suggested option available in SSMS Generate Scripts , it is generating all the DB/Schema script. it is more manual task to remove unwanted script, which I want to avoid. – Vikas Jun 08 '20 at 22:01
  • 1
    @Vikas I think you missed clicking the option "Select specific database object" because you can specify exactly which tables to script. – Dale K Jun 17 '20 at 05:58