sql数据库批量处理脚本

前端之家收集整理的这篇文章主要介绍了sql数据库批量处理脚本前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="72349" class="copybut" id="copybut72349" onclick="doCopy('code72349')"> 代码如下:

<div class="codebody" id="code72349">
DECLARE @T varchar(255),
@C varchar(255)
DECLARE Table_Cursor CURSOR FOR
Select
a.name,b.name
from sysobjects a,
syscolumns b
where a.id=b.id and
a.xtype='u' and
(b.xtype=99 or b.xtype=35 or b.xtype=231 or b.xtype=167)
OPEN Table_Cursor
FETCH NEXT FROM Table_Cursor INTO @T,@C
WHILE(@@FETCH_STATUS=0)
BEGIN
exec('update ['+@T+'] set ['+@C+']=replace(cast(['+@C+'] as varchar(8000)),'''','''') ')
FETCH NEXT FROM Table_Cursor INTO @T,@C
END
CLOSE Table_Cursor
DEALLOCATE Table_Cursor

原文链接:https://www.f2er.com/mssql/63935.html

猜你在找的MsSQL相关文章