select sysobjects.name as tbName,
syscolumns.name as colName,(case when (CHARINDEX(‘char‘, type_name(syscolumns.xtype))>0) then ‘(‘+type_name(syscolumns.xtype)+‘(‘+str(length,3)+‘)‘+‘,‘+(case syscolumns.isnullable when 0 then ‘not null‘ else ‘null‘ end) +‘)‘ else ‘(‘+type_name(syscolumns.xtype)+‘,‘+(case syscolumns.isnullable when 0 then ‘not null‘ else ‘null‘ end) +‘)‘ end) as colType from sysobjects left join syscolumns on syscolumns.id=object_id(sysobjects.name) where sysobjects.xtype=‘U‘ order by sysobjects.name
时间: 2024-10-25 03:32:51