比如我有一个视力
UserView
他是用
Select * FROM User Where [Type] = 'PS'
这样得来的现在怎么去取出这段SQL语句谢谢

解决方案 »

  1.   

    --??
    select text from syscomments where id=object_id('UserView')
      

  2.   

    USE 你的库名;
    EXE sp_helptext '你要查的视图名'
      

  3.   

    create view aa
    as 
    select * from sysobjects
    go
    select text from syscomments where id=object_id('aa')
    go
      

  4.   

    USE 你的库名;
    EXEC sp_helptext '你要查的视图名'
      

  5.   

    USE 数据库名;
    EXEC sp_helptext 'UserView'create view my_vw
    as 
    select a,b from tago
    exec sp_helptext 'my_vw'结果:
    create view my_vw  
    as   
    select a,b from ta