- Use the sp_help procedure.
exec sp_help 'HumanResources.Employee'
- Query the information_schema table.
SELECT column_name
FROM information_schema.columns
WHERE table_name = 'HumanResources.Employee'
ORDER BY ordinal_position
exec sp_help 'HumanResources.Employee'
SELECT column_name
FROM information_schema.columns
WHERE table_name = 'HumanResources.Employee'
ORDER BY ordinal_position
use [db name]
select distinct o.name
from syscomments c
inner join sysobjects o on o.id = c.id
where o.type = 'p'
and c.text like '% [name of db object or string] %'
--and o.name not like 'rpt_%'
order by o.name
In the 'where' clause above the sysobjects.type field is limited to 'p' for [stored] procedure. Another common type I have been searching in lately is a function 'fn'. Someone compiled a helpful list of sysobject types, comparing SQL Server 2000, 2005, and 2008 here.