zoukankan      html  css  js  c++  java
  • MSSQL表中字段更新后,视图中的字段不更新的解决办法

    declare   @viewname   varchar(250),@id   int,@text   varchar(8000)
    declare   #aa   cursor   for   select   id,name
    from   sysobjects
    where   objectproperty(id, 'IsView ')=1   and   uid=1   and   left(name,3<> 'sys '
    open   #aa
    fetch   next   from   #aa   into   @id,@viewname
    while   @@fetch_status=0
    begin
    select   @text= ' '
    select   @text=@text+char(13)+text
    from   syscomments
    where   id=@id
    exec'drop   view   '+@viewname)
    -- print   @viewname
    exec(@text)
    -- print   @text
    fetch   next   from   #aa   into   @id,@viewname
    end
    close   #aa
    deallocate   #aa

    运行一下以上sql即可以更新所有视图

  • 相关阅读:
    JDBC事务
    JDBC连接池和DBUtils
    原生JDBC
    基本的查询语句
    多表查询
    mysql单表
    基础加强_XML
    基础加强_注解_类加载器_动态代理
    页面加载loading动画
    移动端手动控制页面高度
  • 原文地址:https://www.cnblogs.com/yeagen/p/2002916.html
Copyright © 2011-2022 走看看