Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Generate DDL script to create table and all constraints Expand / Collapse
Author
Message
Posted Saturday, March 21, 2009 4:09 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, January 30, 2014 6:59 AM
Points: 12, Visits: 136
Comments posted to this topic are about the item Generate DDL script to create table and all constraints
Post #680892
Posted Friday, February 26, 2010 3:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, December 6, 2012 5:03 AM
Points: 3, Visits: 62
right? this scrips?
Post #873285
Posted Friday, June 25, 2010 2:19 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 29, 2014 4:54 AM
Points: 8, Visits: 149
Hello many pb when compiling SP

Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 13
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 21
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 22
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 22
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 23
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 23
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 24
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 24
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 26
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 28
Incorrect syntax near ' '.
Msg 137, Level 15, State 2, Line 32
Must declare the scalar variable "@Create_Table_Ind".
Msg 156, Level 15, State 1, Line 76
Incorrect syntax near the keyword 'THEN'.
Msg 137, Level 15, State 2, Line 88
Must declare the scalar variable "@PK_Ind".
Msg 137, Level 15, State 2, Line 150
Must declare the scalar variable "@FK_Ind".
Msg 137, Level 15, State 2, Line 194
Must declare the scalar variable "@Check_Ind".
Msg 137, Level 15, State 2, Line 213
Must declare the scalar variable "@Default_Ind".
Msg 102, Level 15, State 1, Line 252
Incorrect syntax near 'END'.
Post #942880
Posted Friday, June 25, 2010 6:41 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, January 30, 2014 6:59 AM
Points: 12, Visits: 136
This SP should be used in SQL Server 2008 version and use the signature as mentioned at the end of the SP.
Post #943004
Posted Friday, June 25, 2010 6:48 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 29, 2014 4:54 AM
Points: 8, Visits: 149
Hi,
thank's for response,

does it work in SQL2005 please ?
Post #943010
Posted Friday, June 25, 2010 6:51 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, January 30, 2014 6:59 AM
Points: 12, Visits: 136
It can but the SP will have to be tweaked to make it work in 2005 ...
Post #943011
Posted Thursday, November 3, 2011 4:17 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, July 29, 2014 8:33 AM
Points: 78, Visits: 95
This is a great script - really helpful - thank you!

Can I suggest a tweak for computed columns too?

Computed columns get created as a regular columns such as varchar(100) but if you left join to sys.computed_columns and use the [definition] column you end up with a column definition like this:

[Fullname] AS (([Firstname]+' ')+[Lastname]),

Hope this helps someone else out there :D
Post #1199795
Posted Wednesday, March 21, 2012 4:49 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, September 19, 2013 4:19 AM
Points: 264, Visits: 189
Not sure if I have done something wrong here, but when generating the script for a table it's not generating the size for DECIMAL & NUMERIC columns?


Post #1270090
Posted Wednesday, March 21, 2012 6:33 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, January 30, 2014 6:59 AM
Points: 12, Visits: 136
Can you send the structure of your table?
Post #1270119
Posted Wednesday, March 21, 2012 8:33 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, September 19, 2013 4:19 AM
Points: 264, Visits: 189
This is just a table I created to test:

CREATE TABLE [dbo].[Table_1](
[col1] [nchar](10) NOT NULL,
[col2] [numeric](25, 12) NULL,
[col3] [xml] NULL,
[col4] [decimal](18, 0) NULL,
[col5] [varchar](max) NULL,
[col6] [varbinary](50) NULL,
[col7] [money] NULL,
[col8] [ntext] NULL,
[col9] [text] NULL,
[col10] [float] NULL,
[col11] AS ([col5]+'aaa'),
[col12] [dbo].[ga_money] NOT NULL
)

Obviously ga_money is a user defined data type



Post #1270214
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse