﻿<?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 / Discuss content posted by Mohit Nayyar / Article Discussions by Author  / Get the Table Structure using a simple query / 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, 18 Jun 2013 00:13:31 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Get the Table Structure using a simple query</title><link>http://www.sqlservercentral.com/Forums/Topic402431-613-1.aspx</link><description>I am looking for this query. Thanks</description><pubDate>Mon, 13 Sep 2010 00:02:19 GMT</pubDate><dc:creator>Hardy21</dc:creator></item><item><title>RE: Get the Table Structure using a simple query</title><link>http://www.sqlservercentral.com/Forums/Topic402431-613-1.aspx</link><description>U can get better information in the following query:Select sysObj.id, sysObj.name, Col.name,'Datatype'=Case When typ.name in ('char','varchar') Then typ.name+'('+Cast(Col.max_length as varchar(10))+')'	When typ.name = 'nvarchar' AND Col.max_length&amp;lt;&amp;gt;-1 Then typ.name+'('+Cast(Col.max_length/2 as varchar(10))+')'	When typ.name = 'nvarchar' AND Col.max_length=-1 Then typ.name+'(MAX)'	When typ.name = 'decimal' Then typ.name+'('+Cast(Col.precision as varchar(5))+','+Cast(Col.scale as varchar(5))+')'	Else typ.nameEnd, 'Length'=Col.max_length, 'isNullable'=Case When Col.is_nullable = 1 Then 'Yes' Else 'No' End,'isIdentity'=Case When Col.is_identity = 1 Then 'Yes' Else 'No' End, Col.column_idFrom sys.columns Col Inner Join sys.sysobjects sysObj ON sysObj.id = Col.object_idInner Join sys.types typ ON typ.user_type_id = Col.user_type_idWhere sysObj.xtype = 'U'and sysObj.name like 'ma_Parts%'order by sysObj.name, Col.column_id;</description><pubDate>Sun, 12 Sep 2010 23:49:06 GMT</pubDate><dc:creator>Uttam Kr. Dhar</dc:creator></item><item><title>RE: Get the Table Structure using a simple query</title><link>http://www.sqlservercentral.com/Forums/Topic402431-613-1.aspx</link><description>Dear Mohit,I have executed the SQL query. It is giving the exact output that you are saying.I found one issue in the output information. if you look it the datatype, it is showing one strange datatype name sysdata in the table structure actually in should not come.can you please look into it and change the query?Thanks,Ayyappan</description><pubDate>Thu, 27 May 2010 07:15:26 GMT</pubDate><dc:creator>Ayyappan Thangaraj</dc:creator></item><item><title>Get the Table Structure using a simple query</title><link>http://www.sqlservercentral.com/Forums/Topic402431-613-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/Miscellaneous/30738/"&gt;Get the Table Structure using a simple query&lt;/A&gt;[/B]</description><pubDate>Tue, 25 Sep 2007 02:29:52 GMT</pubDate><dc:creator>Mohit Nayyar</dc:creator></item></channel></rss>