改机器名处理

if   serverproperty('servername')   <>   @@servername   
         begin   
             declare   @server   sysname   
            set   @server   =   @@servername   
            exec   sp_dropserver   @server   =   @server   
            set   @server   =   cast(serverproperty('servername')   as   sysname)   
            exec   sp_addserver   @server   =   @server   ,   @local   =   'LOCAL'   
        end
posted @ 2011-06-20 13:55  qanholas  阅读(171)  评论(0编辑  收藏  举报