SELECT sps.object_idAs ProcedureId,sps.name As ProcedureName,Sss.name As SchemaName,(casewhen (SELECTCOUNT(*) FROM sys.sysdepends WHERE id=sps.object_idand resultobj=1)=0then0else1end) As IsNeedOpenDb FROM sys.procedures sps INNERJOIN sys.schemas Sss on Sss.schema_id=Sps.schema_id
SELECT ST.object_idAs TableId,SS.name As SchemaName,ST.name As TableName,Sep.value As TableDescription FROM sys.tables ST LEFTOUTERJOIN sys.schemas SS ON SS.schema_id=ST.schema_id LEFTOUTERJOIN sys.extended_properties Sep On Sep.major_id=ST.object_idand minor_id=0
SELECT SC.Colorder As ColumnId , SC.Name As ColumnName,Sep.value As ColumnDescription, St.Name As TypeName, SC.Prec,SC.Scale,SC.Colstat,Sac.Is_Identity,SC.Iscomputed, SC.Isnullable, SC.Colorder,Sic.index_id As KeyIndex,Scs.textAs DefaultValue,Scss.textAs AutoValue FROM sys.syscolumns AS SC LEFTOUTERJOIN sys.systypes St ON (St.xtype=SC.xtype) AND (St.xUSERtype=SC.xtype) LEFTOUTERJOIN sys.syscomments Scs On Scs.Id=SC.cdefault LEFTOUTERJOIN sys.syscomments Scss On Scss.Id=SC.id and Scss.number=SC.colorder LEFTOUTERJOIN sys.all_columns Sac On Sac.object_id=Sc.id and Sac.column_id=SC.Colorder LEFTOUTERJOIN sys.extended_properties Sep On Sep.major_id=Sc.id and Sep.minor_id=SC.Colorder LEFTOUTERJOIN sys.index_columns Sic On Sic.object_id=Sc.id and Sic.column_id=SC.Colorder WHERE (SC.id = 表ID)