Monday, September 10, 2007

SPs referring to a particular table and column

-- SPs referring to a particular table and column
-- Note Dynamic SQLs are skipped

select o.name, o2.name, c.name, d.selall
from sysobjects o
join sysdepends d on o.id = d.id
join sysobjects o2 on o2.id = d.depid
join syscolumns c on c.id = d.depid
and c.colid = d.depnumber
where o2.name = 'account' -- table
and c.name = 'accountid' -- column

No comments: