标题说明我有一个查询,我可以获取除链接表之外的所有表,这是我获取所有表的代码,我正在使用sql 2008。
;WITH stored_procedures AS
(
SELECT
o.name AS proc_name, oo.name AS table_name,
ROW_NUMBER() OVER(partition by o.name,oo.name ORDER BY o.name,oo.name)AS row
FROM sysdepends d
INNER JOIN sysobjects o ON o.id=d.id
INNER JOIN sysobjects oo ON oo.id=d.depid
WHERE o.xtype = 'P'
)
SELECT proc_name, table_name FROM stored_procedures
WHERE row = 1 and proc_name = 'SPNamehere'
ORDER BY proc_name,table_name