﻿<?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 Jacques Bosch  / Super Quick Table Meta Data / 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>Tue, 21 May 2013 22:40:41 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Hi Santiago.Very glad it is of use to you. I still use it almost every day myself. :)Thanx for the 2K work. I hope I never need it! :)</description><pubDate>Thu, 25 Aug 2011 13:34:08 GMT</pubDate><dc:creator>Jacques-897195</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>OK took a stab at making it SQL2K compatible and added Meta Data Description as an extra column. Not perfect but so far it seems  like it works on most of my tables. </description><pubDate>Thu, 25 Aug 2011 11:32:47 GMT</pubDate><dc:creator>Santiago E. Perez</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Just found this article and am thrilled because I am working on a new contract with a crazy DB system. This is immensely valuable except I  need it for SQL2K. Has anyone tackled this yet? I am currently trying to re-work it for SQL2K but my knowledge of system tables is limited so it's taking me a while to inch along. If I get it to work I will share unless someone posts a SQL2K version first. Thanks again Jacques!</description><pubDate>Thu, 25 Aug 2011 08:41:02 GMT</pubDate><dc:creator>Santiago E. Perez</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Nice script!   Thanks for sharing, Jacques!I made some mostly syntactical changes:-  can't assign default values to local variables in SQL 2005-  character case differences will break the code in BINARY (or case sensitive -?) collations</description><pubDate>Wed, 15 Apr 2009 11:57:05 GMT</pubDate><dc:creator>Rich Holt</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Nice article. I have been working on a table based code generator and this may actually allow me to speed things up a little. Code does need tweaking for 2005. The setup section should read something like below to pass the execution.[code]	declare @DBName varchar (20) 	declare @TableSchema varchar (20) 	set @DBName = PARSENAME (@TableName, 3)	set @TableSchema = PARSENAME (@TableName, 2)	set @TableName = PARSENAME (@TableName, 1)	if @DBName is not null		and @DBName != DB_NAME()	begin		print 'Cannot run this on DB ''' + @DBName + '''. Must be run on current DB.'		return;	end	-- Set up some values for displaying the results.	declare @Y varchar (10)	set @Y = '    y'; -- Spacing is for nicer look.	declare @Empty varchar (1) 	set @Empty = '';[/code]</description><pubDate>Wed, 15 Apr 2009 04:10:55 GMT</pubDate><dc:creator>cox.ian</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Hi Arko Oige.No that is incorrect. I have no idea how that version of the code got there but it doesn't include the index count. It should look like the below.[code]	-- If there is more than 1 index on a column, indicate the number of indexes at start.	case 		when ix.IndexCount &amp;gt; 1 then			'(' + CAST (ix.IndexCount as varchar) + ') '		else			@Empty	end	+ case		when ix.type_desc = 'CLUSTERED' then 'c'		when ix.type_desc = 'NONCLUSTERED' then 'nc'		else ix.type_desc	end[/code]Also note that GSquared's 2005 version has another problem with showing up indexes correctly, but I haven't taken a look at that.Below is reattached the SQL 2008 version including the index count.Note, index count will only show up if there is more than 1 index.Let me know if it works for you.</description><pubDate>Wed, 08 Apr 2009 03:26:54 GMT</pubDate><dc:creator>Jacques-897195</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>[quote]In addition, if there is more than one index on a column, it will show the number of indexes in brackets at the start. For example, the IX column might read '(2) c, unique, desc (disable)'[/quote][code]when ix.COLIMN_NAME is not null then    case        when ix.type_desc = 'CLUSTERED' then 'c'        when ix.type_desc = 'NONCLUSTERED' then 'nc'	 else ix.type_desc    end    ...    else        @Empty[/code]This functionality seems not to be working as I have 3 indexes on the same column but still see only “nc, desc” in IX column.Even the code extract shows that column IX always starts with the index type not the count.Am I having an old version of the code or is this functionality to be added in future?Regards,Arko</description><pubDate>Wed, 08 Apr 2009 02:03:56 GMT</pubDate><dc:creator>Arko Oige</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Thanks for the article. Nice little snippet to add to my bag of tricks.I usually create an ERD before creating the tables and keep that updated as things change.But this has uses on its own.Thanks go out to GSquared for doing the 2005 version.</description><pubDate>Thu, 26 Mar 2009 14:15:00 GMT</pubDate><dc:creator>SQLAJ</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Thanx, epriddy, glad to hear it.Bridget, that's been dome multiple times before. You can found SQL 2005 versions in other posts.Seems like reading previous posts before posting is not always a common habit. ;)Don't know if I can modify my article to include the 2K5 version there. I'll find out.</description><pubDate>Tue, 24 Mar 2009 23:36:03 GMT</pubDate><dc:creator>Jacques-897195</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Are going rework it for SQL Server 2005? Thanks.</description><pubDate>Tue, 24 Mar 2009 10:32:24 GMT</pubDate><dc:creator>Bridget Elise Nelson</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>We currently have data dictionaries for much of our data warehouse, but as we build new tables (and corresponding data dictionaries) this will be helpful.  Thanks for the procedure!My minor modifications for 2005 were to set values (instead of default):declare @DBName varchar (20) 	Set @DBName = PARSENAME (@TableName, 3)	declare @TableSchema varchar (20) 	Set @TableSchema = PARSENAME (@TableName, 2)	set @TableName = PARSENAME (@TableName, 1)	if @DBName is not null		and @DBName != DB_NAME()	begin		print 'Cannot run this on DB ''' + @DBName + '''. Must be run on current DB.'		return;	end	-- Set up some values for displaying the results.	declare @Y varchar (10) 	Set @Y= '    y'; -- Spacing is for nicer look.	declare @Empty varchar (1)	Set @Empty = '';I've sent it to the rest of my team and will let you know what they think of it :)</description><pubDate>Tue, 24 Mar 2009 09:42:04 GMT</pubDate><dc:creator>epriddy</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>The 2005 version posted worked great!  Thanks to all of you.</description><pubDate>Tue, 24 Mar 2009 08:58:57 GMT</pubDate><dc:creator>randal.schmidt</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Hi nathan.j.lalonde, see my previous post, 3 up from yours.</description><pubDate>Tue, 24 Mar 2009 08:33:46 GMT</pubDate><dc:creator>Jacques-897195</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Highlighting the table in SMS and ALT+F1 gives pretty much the same data.</description><pubDate>Tue, 24 Mar 2009 08:29:10 GMT</pubDate><dc:creator>nathan.j.lalonde</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>I got it to work on Sql2005 with minor changesHere's the codeif  exists (select * from sys.objects where object_id = OBJECT_ID(N'[dbo].[TableInfo]') and type in (N'P', N'PC'))drop procedure [dbo].[TableInfo]goset ansi_nulls ongoset quoted_identifier ongocreate procedure [dbo].[TableInfo]	@TableNam varchar (700),	-- Can include schema/owner.	@FieldNameFilter varchar (700) = null, -- Compared with the like operator.	@Extended bit = 0 -- For showing extra tableInfo such as triggersas	--*****************************************	-- Author:			Jacques Bosch	-- Last Modified:	25 Feb 2009	--*****************************************	set concat_null_yields_null off	declare @DBName varchar (20) 	Set @DBName = PARSENAME (@TableNam, 3)--Stuart changed		declare @TableSchema varchar (20) 	Set @TableSchema= PARSENAME (@TableNam, 2)--Stuart changed		Declare @TableName varchar (700)	set @TableName = PARSENAME (@TableNam, 1)--Stuart changed		if @DBName is not null		and @DBName != DB_NAME()	begin		print 'Cannot run this on DB ''' + @DBName + '''. Must be run on current DB.'		return;	end	-- Set up some values for displaying the results.	declare @Y varchar (10) 	Set @Y = '    y' -- Spacing is for nicer look.	declare @Empty varchar (1) 	Set @Empty = ''; --Stuart changed. Added the ';'	-- First get all the existing constraint tableInfo that is needed for the table.	-- We are querying into a common table expression.	with tableConstraints	as	(		select distinct			tbl.TABLE_NAME,			kcu.TABLE_SCHEMA,			col.COLUMN_NAME,			tc.CONSTRAINT_NAME,			tc.CONSTRAINT_TYPE,			tc.TABLE_SCHEMA + '.' + OBJECT_NAME(sfk.RKEYID) as FK_Table,			COL_NAME(RKEYID, RKEY) as FK_Field,			OBJECTPROPERTY(sfk.CONSTID, 'CNSTISDISABLED') as FK_Disabled		from			Information_Schema.Tables tbl			inner join			Information_Schema.Columns col				on col.TABLE_NAME = tbl.TABLE_NAME			inner join			INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu				on kcu.TABLE_NAME = col.TABLE_NAME				and kcu.COLUMN_NAME = col.COLUMN_NAME			inner join			INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc				on tc.TABLE_NAME = kcu.TABLE_NAME				and tc.CONSTRAINT_NAME = kcu.CONSTRAINT_NAME			left outer join			SYSFOREIGNKEYS sfk				on OBJECT_NAME(sfk.CONSTID) = kcu.CONSTRAINT_NAME				and OBJECT_NAME(sfk.FKEYID) = kcu.TABLE_NAME				and COL_NAME(FKEYID, FKEY) = kcu.COLUMN_NAME		where			kcu.TABLE_NAME = @TableName			and			(				@TableSchema is null				or kcu.TABLE_SCHEMA = @TableSchema			)	),	otherConstraint	as	(		-- List the first of other tableConstraints, such as a unique constraint.		select top 1 			cons.TABLE_SCHEMA,			cons.TABLE_NAME,			cons.COLUMN_NAME,			cons.CONSTRAINT_TYPE		from			INFORMATION_SCHEMA.Columns c			inner join			tableConstraints cons				on cons.TABLE_SCHEMA = c.TABLE_SCHEMA				and cons.TABLE_NAME = c.TABLE_NAME				and cons.COLUMN_NAME = c.COLUMN_NAME				and cons.CONSTRAINT_TYPE not in ('PRIMARY KEY', 'FOREIGN KEY')	),	tableIndexes	as	(		select			OBJECT_SCHEMA_NAME (sc.object_id) as TABLE_SCHEMA,			OBJECT_NAME (sc.object_id) as TABLE_NAME,			sc.name as COLIMN_NAME,			-- Because we can have more than one index per column, this will cause multiple			-- rows per column in our results set. Hence, we aggregate to prevent this, showing			-- only one index per column.			MIN (i.type_desc) as type_desc, -- Prefers clusterred over nonclusterred if both exist.			-- We cast to tinyint because MIN and MAX don't work with bit.			MAX (CAST (i.is_unique as tinyint)) as is_unique,-- Prefers unique indexes over non-unique.			MIN (CAST (i.is_disabled as tinyint)) as is_disabled, -- Prefers enabled indexes over disabled.			MAX (CAST (ic.is_descending_key as tinyint)) as is_descending_key -- Prefers descending indexes over ascending.		from			sys.columns sc			inner join			sys.indexes i				on i.object_id  = sc.object_id 			inner join			sys.index_columns ic				on ic.index_id = i.index_id				and ic.object_id = sc.object_id				and ic.column_id = sc.column_id		where			object_name (sc.object_id) = @TableName			and			(				@TableSchema is null				or object_schema_name (sc.object_id) = @TableSchema			)		group by			OBJECT_SCHEMA_NAME (sc.object_id), -- TABLE_SCHEMA			OBJECT_NAME (sc.object_id), -- TABLE_NAME			sc.name -- COLIMN_NAME	),	tableInfo	as	(		-- Gather the info we want to display.		select distinct			c.TABLE_SCHEMA as [Schema],			-- Show Primary Key			case when pk.TABLE_NAME IS NOT NULL				then					'pk'				else					@Empty			end as PK,			-- Show FOREIGN KEY			case when fk.TABLE_NAME IS NOT NULL				then					'fk'				else					@Empty			end			+ -- Show when the foreign key is disabled.			case				when ISNULL (fk.FK_Disabled, 0) = 1 then					' (disabled)'				else					@Empty			end			as FK,			-- Show index tableInfo, such as clustered / nonclustered, if unique, if descending, if disabled, etc.			case				when ix.COLIMN_NAME is not null then					case						when ix.type_desc = 'CLUSTERED' then 'c'						when ix.type_desc = 'NONCLUSTERED' then 'nc'						else ix.type_desc					end					+ case						when ix.is_unique = 1 then ', unique'						else @Empty					end					+ case						when ix.is_descending_key = 1 then ', desc'						else @Empty					end					+ case						when ix.is_disabled = 1 then ' (disabled)'						else @Empty					end				else					@Empty				end			as IX,			-- Show the first of any other CONSTRAINTS			ISNULL (oc.CONSTRAINT_TYPE,  @Empty) as Cons,						c.COLUMN_NAME as ColumnName,			-- Show the data type.			case				when c.DATA_TYPE like '%int' then					c.DATA_TYPE				when c.DATA_TYPE = 'bit' then					c.DATA_TYPE				 when c.DATA_TYPE like '%datetime' then					c.DATA_TYPE  -- + ' (' + CAST (c.DATETIME_PRECISION as VARCHAR) + ')'				when c.DATA_TYPE like '%char%'then					c.DATA_TYPE  + ' (' + CAST (c.CHARACTER_MAXIMUM_LENGTH as VARCHAR) + ')'				when c.NUMERIC_PRECISION IS NOT NULL and c.NUMERIC_SCALE IS NOT NULL then					c.DATA_TYPE + ' (' + CAST (c.NUMERIC_PRECISION as VARCHAR) + ',' + CAST (c.NUMERIC_SCALE as VARCHAR) + ')'				else					c.DATA_TYPE			end			+ -- After datatype, also show if identity.			case				when syscol.[status] = 128 then -- 128 = Identity					' (identity)'				else					@Empty			end			as DataType,						case				when c.IS_NULLABLE = 'yes' then					@Y				else					@Empty			end as Nullable,			case				when COLUMNPROPERTY(syscol.id, syscol.name, 'IsComputed') = 1 then					@Y				else					@Empty			end as Computed,			-- Default value of column.			c.COLUMN_DEFAULT as [Default],			-- Show foreign key table if there is one			case				when fk.TABLE_NAME IS NOT NULL then					fk.FK_Table				else					@Empty			end as [FK Table],			-- Show the column in the foreign key table to which the key relates.			case				when fk.TABLE_NAME IS NOT NULL then					fk.FK_Field				else					@Empty			end as [FK Field],						-- Show the name of the constraint if there is one.			case				when fk.CONSTRAINT_NAME IS NOT NULL then					fk.CONSTRAINT_NAME				else					@Empty			end as [Constraint Name],			-- For showing the results in the correct order.			C.ORDINAL_POSITION					from			Information_Schema.Tables t			inner join			INFORMATION_SCHEMA.Columns c				on c.TABLE_SCHEMA = t.TABLE_SCHEMA				and c.TABLE_NAME = t.TABLE_NAME			inner join			syscolumns syscol				on OBJECT_NAME(syscol.id) = t.TABLE_NAME				and syscol.Name = c.COLUMN_NAME				-- Including schema in join incurs big performance hit, and shouldn't be necessary (mostly).				-- and OBJECT_SCHEMA_NAME (syscol.id) = c.TABLE_SCHEMA			left outer join			tableConstraints pk				on pk.TABLE_SCHEMA = t.TABLE_SCHEMA				and pk.TABLE_NAME = t.TABLE_NAME				and pk.COLUMN_NAME = c.COLUMN_NAME				and pk.CONSTRAINT_TYPE = 'PRIMARY KEY'			left outer join			tableConstraints fk				on fk.TABLE_SCHEMA = t.TABLE_SCHEMA				and fk.TABLE_NAME = t.TABLE_NAME				and fk.COLUMN_NAME = c.COLUMN_NAME				and fk.CONSTRAINT_TYPE = 'FOREIGN KEY'			left outer join			otherConstraint oc				on oc.TABLE_SCHEMA = t.TABLE_SCHEMA				and oc.TABLE_NAME = t.TABLE_NAME				and oc.COLUMN_NAME = c.COLUMN_NAME			left outer join			tableIndexes ix				on ix.TABLE_SCHEMA = t.TABLE_SCHEMA				and ix.TABLE_NAME = t.TABLE_NAME				and ix.COLIMN_NAME = c.COLUMN_NAME		where			t.TABLE_NAME = @TableName			and			(				@TableSchema IS NULL				or t.TABLE_SCHEMA = @TableSchema			)	)	-- Return the results	select		[Schema],		PK,		FK,		IX,		Cons,		ColumnName,		DataType,		Nullable,		Computed,		[Default],		[FK Table],		[FK Field],		[Constraint Name]	from tableInfo	where		(			@TableSchema IS NULL			or [Schema] = @TableSchema		)		and		(			@FieldNameFilter IS NULL			or ColumnName LIKE @FieldNameFilter		)		order by		[Schema],		ORDINAL_POSITION		-- Also return the list of triggers on this table if there are any, and if extended tableInfo is on.	if @Extended = 1		and exists (select * from sys.triggers where OBJECT_NAME (parent_id) = @TableName)	begin		select			t.name as [Trigger Name],			case when t.is_ms_shipped = 1 then @Y else @Empty end as [MS Shipped],			case when t.is_disabled = 1 then @Y else @Empty end as [Disabled],			case when t.is_instead_of_trigger = 1 then @Y else @Empty end as [Instead Of],			case when t.is_not_for_replication = 1 then @Y else @Empty end as [Not for Replication],			t.modify_date as Modified,			t.create_date as Created		from			sys.triggers t		where			OBJECT_NAME (t.parent_id) = @TableName	end</description><pubDate>Tue, 24 Mar 2009 07:26:41 GMT</pubDate><dc:creator>Stuarts-821176</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Hey JacquesNow it works, thanks for a fine job.regards Tommy</description><pubDate>Tue, 24 Mar 2009 07:26:34 GMT</pubDate><dc:creator>Tommy Balle</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Thank you, Bruce W Cassidy, for posting the SQL 2K5 version, although GSquared had already uploaded one in an earlier post.Tommy Balle, and randal.schmidt, did you come right with the 2K5 versions provided by the guys above? I'm sorry that I didn't test it for compatibility with SQL Server 2005, but in my own defense, I did mention this right at the end of the article.Rich Holt, can you point out the character case problems that you mentioned?hardtarget_x wrote:&amp;gt;You know a feature that would be neat to add, if you left the table empty or put in a %, and then typed in a column name... Then return all&amp;gt;of the tables that hold that specific column name.Yes I like that. Then you could get a quick overview of the columns you are getting back from multiple tables and compare their data types etc.Concerning the sp_help proc, yes I should have probably mentioned it. It definitely returns more info than TableInfo does. However, the TableInfo proc, when not using the extended flag, returns a compact yet reasonably  comprehensive single resultset. It very clearly shows up which columns have indexes and foreign keys, and to which tables and fields those link to. When using it, most info relevant to a column is right there in the single row for that column, and you don't have to scan through the multiple resultsets as you would have to when using sp_help. Mix and use them as you want, but personally I very rarely have to revert back to sp_help to get what I'm looking for.As Tony Webster said, if we don't like, or have a use for what comes out of the box, we can write something that better suits our needs / method of working. We can change the box :)</description><pubDate>Tue, 24 Mar 2009 06:27:11 GMT</pubDate><dc:creator>Jacques-897195</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>[font="Verdana"]Here's a modified form that will work with SQL Server 2005.Note that I have not reviewed the code other than to change the issue of assignment during variable declaration (a SQL Server 2008 feature.)[/font]</description><pubDate>Mon, 23 Mar 2009 14:16:16 GMT</pubDate><dc:creator>Bruce W Cassidy</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Just change the lines that read:declare @DBName varchar (20) = PARSENAME (@TableName, 3)todeclare @DBName varchar (20) set @DBName = PARSENAME (@TableName, 3)SQLServer 2005 just requires 2 rows instead of 1 row.</description><pubDate>Mon, 23 Mar 2009 12:20:27 GMT</pubDate><dc:creator>crapper_mail</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>But surprisingly, not triggers.</description><pubDate>Mon, 23 Mar 2009 12:18:31 GMT</pubDate><dc:creator>crapper_mail</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Hi Rich,This seems to scare some people but it works very nicely in my experience:By setting stored procedures as being a "system object", you can create them in the master database, prefix them with "sp_", and have them run in any database "natively".The proc for doing this is "sp_ms_marksystemobject" - it works in 2000 and 2005, I have not tested in 2008.Hope this helps!Tao</description><pubDate>Mon, 23 Mar 2009 10:40:09 GMT</pubDate><dc:creator>Tao Klerks</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>By default, we use a BINARY collation on my team.  The TableInfo code has a few character case problems, which were easy to find and fix.  Same goes for the assignment of default values to local variables; easy enough to fix in the script.Don't make the assumption that you can prefix the proc name with "sp_" ,  create it in master, and have it work in any User database.  It won't necessarily generate any errors, but it also won't generate any output.Thanks for the example, it presents some food for thought.  :-)</description><pubDate>Mon, 23 Mar 2009 10:17:30 GMT</pubDate><dc:creator>Rich Holt</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>olathought i saw that code somewhere, was thinking of until ... your name dawned on me :-D</description><pubDate>Mon, 23 Mar 2009 09:35:41 GMT</pubDate><dc:creator>andrewa</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Please see the above attached 2005 friendly script...</description><pubDate>Mon, 23 Mar 2009 08:38:10 GMT</pubDate><dc:creator>Adam Seniuk</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>I had the same issue with SQl Server 2005.  Could not buikd the sp.Msg 139, Level 15, State 1, Procedure TableInfo, Line 0Cannot assign a default value to a local variable.Msg 139, Level 15, State 1, Procedure TableInfo, Line 0Cannot assign a default value to a local variable.Msg 137, Level 15, State 2, Procedure TableInfo, Line 17Must declare the scalar variable "@DBName".Msg 137, Level 15, State 2, Procedure TableInfo, Line 20Must declare the scalar variable "@DBName".Msg 139, Level 15, State 1, Procedure TableInfo, Line 0Cannot assign a default value to a local variable.Msg 139, Level 15, State 1, Procedure TableInfo, Line 0Cannot assign a default value to a local variable.Msg 137, Level 15, State 2, Procedure TableInfo, Line 65Must declare the scalar variable "@TableSchema".Msg 102, Level 15, State 1, Procedure TableInfo, Line 86Incorrect syntax near ','.Msg 137, Level 15, State 2, Procedure TableInfo, Line 116Must declare the scalar variable "@TableSchema".Msg 137, Level 15, State 2, Procedure TableInfo, Line 135Must declare the scalar variable "@Empty".Msg 137, Level 15, State 2, Procedure TableInfo, Line 316Must declare the scalar variable "@TableSchema".Msg 137, Level 15, State 2, Procedure TableInfo, Line 335Must declare the scalar variable "@Y".</description><pubDate>Mon, 23 Mar 2009 08:33:45 GMT</pubDate><dc:creator>randal.schmidt</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>You know a feature that would be neat to add, if you left the table empty or put in a %, and then typed in a column name... Then return all of the tables that hold that specific column name.Just thinking out loud. :D</description><pubDate>Mon, 23 Mar 2009 08:23:49 GMT</pubDate><dc:creator>Adam Seniuk</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Hey GSquared, thanks for that post. - Haven't moved to '08 yet.</description><pubDate>Mon, 23 Mar 2009 08:19:51 GMT</pubDate><dc:creator>Tom Van Harpen</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Thanx, SSCertifiable Squared, for converting it to be SQL 2K5 friendly.Yes, I used some features such as the variable initialization that are features of 2K8, as that is all that I'm using these days.I'll comment on the other points such as sp_help later.Thanx much.</description><pubDate>Mon, 23 Mar 2009 07:48:57 GMT</pubDate><dc:creator>Jacques-897195</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>I like the proc.  I made a modified version that works in SQL 2005 (since that's what I'm using right now).  If anyone else wants to check that out, I've attached it to this post.</description><pubDate>Mon, 23 Mar 2009 07:34:54 GMT</pubDate><dc:creator>GSquared</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Keyboard customization is Very cool!</description><pubDate>Mon, 23 Mar 2009 07:18:34 GMT</pubDate><dc:creator>mtraphagen</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>It may be that SQL 2008 allows values to be assigned to local variables in the declaration, but SQL 2005 does not.</description><pubDate>Mon, 23 Mar 2009 06:57:40 GMT</pubDate><dc:creator>Carla Hepker</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>it be nice if the code actually works. I get the same errors.</description><pubDate>Mon, 23 Mar 2009 06:55:10 GMT</pubDate><dc:creator>Pieter-423357</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>I've got something similar I wrote that I use. Possibly worth pointing out that you can bind your own stored procedures to keys using "Customise" in SSMS and QA (e.g. Options -&amp;gt; Environment -&amp;gt; Keyboard in SSIS). I guess like the author, I want something that shows the information that I think is more useful to me than alt-F1 / sp_help gives me. For example, my equivalent of alt-F1 gives the corresponding "CREATE TABLE" and "SELECT" statements for the table, which I can then just copy, paste and edit, and shows the metadata descriptions of the fields.I think the general point though is that you don't have to live with the metadata tools and procedures they give you - there is ample scope to extend them a bit to suit yourself better.</description><pubDate>Mon, 23 Mar 2009 04:59:28 GMT</pubDate><dc:creator>Tony Webster</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>I generally highlight on the Table and Press Alt + F1 (shortcut for sp_help) which gives me all the table details..</description><pubDate>Mon, 23 Mar 2009 03:30:41 GMT</pubDate><dc:creator>vivekanand-246309</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Nice piece of work but, you could also type out the table name, highlight it and press Alt + F1 in SSMS, this will return all schema information for the table including keys, indexes and constraints.</description><pubDate>Mon, 23 Mar 2009 03:19:48 GMT</pubDate><dc:creator>sandeep187</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>HelloI could use this metadata schema, but I could not get it to work in 2005 version.I got some errors when running the script:Msg 139, Level 15, State 1, Procedure TableInfo, Line 0Cannot assign a default value to a local variable.Msg 139, Level 15, State 1, Procedure TableInfo, Line 0Cannot assign a default value to a local variable.Msg 137, Level 15, State 2, Procedure TableInfo, Line 17Must declare the scalar variable "@DBName".Msg 137, Level 15, State 2, Procedure TableInfo, Line 20Must declare the scalar variable "@DBName".Msg 139, Level 15, State 1, Procedure TableInfo, Line 0Cannot assign a default value to a local variable.Msg 139, Level 15, State 1, Procedure TableInfo, Line 0Cannot assign a default value to a local variable.Msg 137, Level 15, State 2, Procedure TableInfo, Line 65Must declare the scalar variable "@TableSchema".Msg 102, Level 15, State 1, Procedure TableInfo, Line 86Incorrect syntax near ','.Msg 137, Level 15, State 2, Procedure TableInfo, Line 116Must declare the scalar variable "@TableSchema".Msg 137, Level 15, State 2, Procedure TableInfo, Line 135Must declare the scalar variable "@Empty".Msg 137, Level 15, State 2, Procedure TableInfo, Line 316Must declare the scalar variable "@TableSchema".Msg 137, Level 15, State 2, Procedure TableInfo, Line 335Must declare the scalar variable "@Y".tballe</description><pubDate>Mon, 23 Mar 2009 02:47:46 GMT</pubDate><dc:creator>Tommy Balle</dc:creator></item><item><title>RE: Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Interesting article, it would probably benefit from at least a passing mention of the built-in stored procedure [b]sp_help[/b], mentioning how the custom procedure is better or more appropriate for a given situation.</description><pubDate>Mon, 23 Mar 2009 02:00:06 GMT</pubDate><dc:creator>Tao Klerks</dc:creator></item><item><title>Super Quick Table Meta Data</title><link>http://www.sqlservercentral.com/Forums/Topic681240-1515-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/articles/meta+data/66266/"&gt;Super Quick Table Meta Data&lt;/A&gt;[/B]</description><pubDate>Mon, 23 Mar 2009 00:30:18 GMT</pubDate><dc:creator>Jacques-897195</dc:creator></item></channel></rss>