sp_help Sys_user--Table StructureSELECT 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= 'Sys_user'--Table nameORDER byCol.colorder; --Table DescriptionSELECTtbs.name table name, ds.value description fromsys.extended_properties DS Left JOINsysobjects TBS onds.major_id=tbs.idWHEREds.minor_id=0 andTbs.name='Sys_user';--Table name
SQL Server 2008 View table description, and table structure