select
u.name,
t.name,
c.name,
d.name,
NULL,
'',''
from
sysusers u,
sysobjects t,
syscolumns c,
systypes d
where
c.id = t.id
and u.uid = t.uid
and c.xusertype<>c.xtype
and d.xusertype=c.xusertype
and c.iscomputed <> 1
and c.cdefault=0
[ and u.name='%OWNER%']
[ and t.name='%TABLE%']
[ and c.name = '%COLUMN%']
union select
u.name,
t.name,
c.name,
d.name,
NULL,
LTRIM(REVERSE(SUBSTRING(REVERSE(x.text), 1, PATINDEX('% sa %', REVERSE(x.text))))),''
from
sysusers u,
sysobjects t,
syscolumns c,
systypes d,
syscomments x
where
c.id = t.id
and u.uid = t.uid
and c.xusertype<>c.xtype
and d.xusertype = c.xusertype
and c.iscomputed <> 1
and c.cdefault <> 0
and x.id=d.tdefault
[ and u.name='%OWNER%']
[ and t.name='%TABLE%']
[ and c.name = '%COLUMN%']
union select
u.name,
t.name,
c.name,
NULL,
x.text,
'',''
from
sysusers u,
syscomments x,
sysobjects t,
syscolumns c
where
u.uid = t.uid and
x.id=t.id and
c.id=t.id and
c.colid=x.number and
c.iscomputed=1
[ and u.name='%OWNER%']
[ and t.name='%TABLE%']
[ and c.name = '%COLUMN%']
union
select
sysusers.name,
sysobjects.name ,
syscolumns.name ,'','','',
convert(varchar(200),sysproperties.value)
from
sysusers,
sysobjects,
syscolumns,
sysproperties
where
sysobjects.id = syscolumns.id
and sysusers.uid = sysobjects.uid
and sysobjects.xtype = 'U'
and syscolumns.id = sysproperties.id
and syscolumns.colid = sysproperties.smallid
[ and sysusers.name='%OWNER%']
[ and sysobjects.name='%TABLE%']
[ and syscolumns.name = '%COLUMN%']
select
u.name,
t.name,
c.name,
o.name,
m.text
from
dbo.syscolumns c,
dbo.sysobjects t,
dbo.sysusers u,
dbo.sysconstraints k,
dbo.syscomments m,
dbo.sysobjects o
where
o.xtype = 'C'
and u.uid = t.uid
and c.id = t.id
and k.id = t.id
and o.id = k.constid
and k.colid = c.colid
and k.constid = m.id
[ and t.name = '%TABLE%']
[ and u.name = '%OWNER%']
[ and c.name = '%COLUMN%']
select
sysusers.name,
sysobjects.name ,
convert(varchar(200),sysproperties.value)
from sysusers,
sysobjects,
sysproperties
where sysobjects.id = sysproperties.id
and sysobjects.xtype = 'U'
and sysproperties.smallid = 0
[ and sysusers.name='%OWNER%']
[ and sysobjects.name='%TABLE%']
select
u.name,
t.name,
o.name,
m.text
from
dbo.sysobjects t,
dbo.sysusers u,
dbo.sysconstraints k,
dbo.syscomments m,
dbo.sysobjects o
where
o.xtype = 'C'
and u.uid = t.uid
and k.id = t.id
and o.id = k.constid
and k.constid = m.id
and k.colid=0
[ and t.name = '%TABLE%']
[ and u.name = '%OWNER%']