--Quick View of table structure (more comprehensive)SELECT Case whenCol.colorder= 1 ThenObj.nameELSE "' END astable name, Col.colorder asserial number, Col.name ascolumn name,ISNULL(ep.[value],"') ascolumn description, T.name asdata type, Col.length aslength,ISNULL(ColumnProperty(Col.id, Col.name,' Scale'),0) asNumber of decimal digits, Case when ColumnProperty(Col.id, Col.name,'isidentity')= 1 Then '√' ELSE "' END asidentification, Case when EXISTS(SELECT 1 fromdbo.sysindexes siINNER JOINDbo.sysindexkeys Sik onSi.id=sik.id andSi.indid=Sik.indidINNER JOINDbo.syscolumns SC onSc.id=sik.id andSc.colid=Sik.colidINNER JOINDbo.sysobjects so onSo.name=Si.name andSo.xtype= 'PK' WHERESc.id=col.id andSc.colid=Col.colid) Then '√' ELSE "' END asprimary KEY, Case whenCol.isnullable= 1 Then '√' ELSE "' END asallow NULL,ISNULL(Comm.text,"') asDefault Value fromDbo.syscolumns Col Left JOINDbo.systypes T onCol.xtype=T.xusertypeInner JOINDbo.sysobjects obj onCol.id=obj.id andObj.xtype= 'U' andObj.status>= 0 Left JOINDbo.syscomments Comm onCol.cdefault=comm.id Left JOINSys.extended_properties EP onCol.id=ep.major_id andCol.colid=ep.minor_id andEp.name= 'ms_description' Left JOINSys.extended_properties Eptwo onObj.id=eptwo.major_id andeptwo.minor_id= 0 andEptwo.name= 'ms_description'WHEREObj.name= 'egression'--Table nameORDER byCol.colorder;
The code above applies to the SQL Server database, only changes the table name and executes the code to get the basic information for the table (code from Network: http://blog.csdn.net/changhong009/article/details/29587063)
Here is the simple code (not tested)
SELECTT.[name] asTable name, C.[name] asField name,cast(ep.[value] as varchar( -)) as [Field Description] fromSys.tables asTINNER JOINsys.columns asC onT.object_id =C.object_id Left JOINSys.extended_properties asEP onep.major_id=C.object_id andep.minor_id=c.column_idWHEREEp.class=1 andT.name='TableName'
SQL Server field Description Query (table basic information query)