22,209
社区成员
发帖
与我相关
我的任务
分享
create view my_view as select a.* , b.job_desc,b.min_lvl , b.max_lvl from employee a , jobs b where a.job_id = b.job_id
go
select text from syscomments where id = object_id('my_view')
drop view my_view
/*
text
-----------------------------------------------------------------------------------------------------------------------
create view my_view as select a.* , b.job_desc,b.min_lvl , b.max_lvl from employee a , jobs b where a.job_id = b.job_id
(所影响的行数为 1 行)
*/
select
视图名=v_o.name,
相关表名=t_o.name,
视图列名=v_c.name,
对应表字段名=t_c.name
from sysdepends d
,sysobjects v_o,syscolumns v_c
,sysobjects t_o,syscolumns t_c
where objectproperty(d.id,'IsView')=1
and d.id=v_o.id and v_o.id=v_c.id
and d.depnumber=v_c.colid
and d.depid=t_o.id and t_o.id=t_c.id
and d.depnumber=t_c.colid
-- and v_o.name='xx' --要查询的视图名
order by d.id