﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Ryan Foote  / Table Generator for defined tables / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 05:57:41 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Table Generator for defined tables</title><link>http://www.sqlservercentral.com/Forums/Topic729868-1560-1.aspx</link><description>Correct.  The script does not handle foreign keys.  Thanks for catching that.Thank you,-Ryan Foote</description><pubDate>Mon, 24 May 2010 08:04:26 GMT</pubDate><dc:creator>foote.ryan</dc:creator></item><item><title>RE: Table Generator for defined tables</title><link>http://www.sqlservercentral.com/Forums/Topic729868-1560-1.aspx</link><description>Ryan,In your article I see 'And, the script currently does handle foreign keys. ' Was there supposed to be a does not in there - I don't see the logic for scripting Foreign Keys.Nice Work,Doug</description><pubDate>Mon, 24 May 2010 07:42:43 GMT</pubDate><dc:creator>Douglas Osborne-456728</dc:creator></item><item><title>RE: Table Generator for defined tables</title><link>http://www.sqlservercentral.com/Forums/Topic729868-1560-1.aspx</link><description>[quote][b]ziangij (5/19/2010)[/b][hr]thanks... but there is one issue though... 1. create some user defined types in your database say UdtIntEntity2. when you execute this query, you will get one row for each type viz. Int, UdtIntEntity for the SAME table column.[/quote]try this code...[code="sql"]EXEC dbo.sp_addtype N'UdtIntEntity ', N'int',N'not null'EXEC dbo.sp_addtype N'udtDesc', N'varchar(500)',N'not null'EXEC dbo.sp_addtype N'udtName', N'varchar(500)',N'not null'CREATE TABLE [dbo].[abc](	 [col1] INT IDENTITY(1,1) NOT NULL	,[col2] VARCHAR(15) NOT NULL	,[col3] VARCHAR(500) NOT NULL CONSTRAINT [PK_abc_col1] PRIMARY KEY CLUSTERED (	[col1] ASC))[/code]then run your code for table abc...the output will be something like this...[code="sql"]if not exists(select * from sysobjects where id = object_id('abc') and objectproperty(ID, N'IsUserTable') = 1)beginCreate Table dbo.abc( [col1]                            int                           NOT NULL IDENTITY (1, 1) [col1]                            UdtIntEntity                  NOT NULL IDENTITY (1, 1),[col2]                            varchar(15)                 NOT NULL ,[col2]                            udtDesc				  NOT NULL ,[col2]                            udtName                 NOT NULL ,[col3]                            varchar(500)                  NOT NULL ,[col3]                            udtDesc                 NOT NULL ,[col3]                            udtName                 NOT NULL )[/code]</description><pubDate>Wed, 19 May 2010 05:37:54 GMT</pubDate><dc:creator>ziangij</dc:creator></item><item><title>RE: Table Generator for defined tables</title><link>http://www.sqlservercentral.com/Forums/Topic729868-1560-1.aspx</link><description>thanks... but there is one issue though... 1. create some user defined types in your database say UdtIntEntity2. when you execute this query, you will get one row for each type viz. Int, UdtIntEntity for the SAME table column.</description><pubDate>Wed, 19 May 2010 05:34:09 GMT</pubDate><dc:creator>ziangij</dc:creator></item><item><title>RE: Table Generator for defined tables</title><link>http://www.sqlservercentral.com/Forums/Topic729868-1560-1.aspx</link><description>I think the system generated would do fine for me.....but informative though ...and I was wondering why not use the keyword QUOTENAME to get the table name in square brackets '[ ]'</description><pubDate>Thu, 11 Jun 2009 03:48:59 GMT</pubDate><dc:creator>Linson.Daniel</dc:creator></item><item><title>Table Generator for defined tables</title><link>http://www.sqlservercentral.com/Forums/Topic729868-1560-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/T-SQL/67149/"&gt;Table Generator for defined tables&lt;/A&gt;[/B]</description><pubDate>Fri, 05 Jun 2009 10:02:40 GMT</pubDate><dc:creator>foote.ryan</dc:creator></item></channel></rss>