Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By VPSD Gupta,
Sometimes you quickly need to generate SQL Statements within your SPs or your front-end code to manipulate data in various ways. This SP generates all the SQL Statements of an existing table in a database to create a table, create Primary Key, create various Foreign Keys, create check constraints and create Defaults on every column of a table.
Use the SP by passing the following parameters:
EXEC usp_Create_Table_DDLs @sTable_Name = 'MY_TABLE', @Create_Table_Ind = 1, @PK_Ind = 1, @FK_Ind = 1, @Check_Ind = 1, @Default_Ind = 1
By default all the indicator variables are set to 1 but you can change that to 0 if you don't need the SQL for that.
Default parameters when database is created with Studio
Is there a way of defaulting a gived SQL login to every database created?
The default database is one of the options when creating a login in SQL Server. This is the...
User creates objects in dbo other than the default schema
Getting an error while creating a default constraint dynamically