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.