데이터베이스 산출물(스키마 내역서) Export
declare @tab varchar(256)
declare tabinfo cursor for
select name from sysobjects where xtype='u' order by name --사용자 정의 테이블
open tabinfo
fetch from tabinfo into @tab
while @@fetch_status=0
begin
select @tab
select
syscolumns.name,
ISNULL(value, '') as FLD_DESC,
systypes.name,
syscolumns.length,
case isnullable when 0 then 'NOT NULL' else 'NULL'
end 'Nullable'
from
systypes,
syscolumns left outer join
::fn_listextendedproperty (NULL, 'user', 'dbo', 'table',@tab, 'column', default) c
on (syscolumns.name = c.objname collate Korean_Wansung_CI_AS )
where
syscolumns.id=object_id(@tab)
and syscolumns.xusertype =systypes.xusertype
order by colid
fetch from tabinfo into @tab
end
close tabinfo
deallocate tabinfo
출처 : http://kr.blog.yahoo.com/fazio127/7