首页蓝耳朵|小小蓝耳朵广州图书馆外文室英语儿童读物资源介绍网佛教青年之友旧版收集永硕E盘Phonics Short Vowels Game 
取MS SQL 2005的数据库结构
所属栏目:MS SQL 2008  时间:2009-04-07 10:15  作者:狼子
select
表名        =  case when A.colorder = 1 then D.name else ' ' end,
表说明      =  case when A.colorder = 1 then ISNULL(F.VALUE, ' ') else ' ' end,
字段序号    =  A.COLORDER,
字段名      =  A.name,
标识        =  case when columnproperty(A.ID,A.name, 'isidentity') = 1 then '√' else '' end,
主键        =  case when exists(
                    select 1     from SYSOBJECTS
                     where XTYPE = 'PK ' and PARENT_OBJ=A.ID
                       and name IN (
                           select name  from SYSINDEXES
                            where INDID IN (
                                  select INDID from SYSINDEXKEYS
                                   where ID = A.ID and COLID = A.COLID
                            )
                       )
               ) then '√ ' else ' ' end,
类型        =  B.name,
字段大小    =  A.LENGTH, 
小数位数    =  ISNULL(columnproperty(A.ID,A.name, 'SCALE '),0), 
允许空      =  case when  A.ISNULLABLE=1 then '√ 'else  ' ' end, 
预设值      =  ISNULL(E.TEXT, ' '), 
字段说明    =  ISNULL(G.[VALUE], ' ')
 from SYSCOLUMNS       A
 left join SYSTYPES    B on A.XUSERTYPE = B.XUSERTYPE
inner join SYSOBJECTS  D on A.ID = D.ID and D.XTYPE = 'U ' and D.name <> 'DTPROPERTIES'
 left join SYSCOMMENTS E on A.CDEFAULT = E.ID
 left join sys.extended_properties    G on A.ID = G.major_id and A.COLID = G.minor_id
 left join sys.extended_properties    F on D.ID = F.major_id and F.minor_id = 0
小楼宝宝的涂鸦花花(Imitater)的博客起名称骨测字