您现在的位置是:网站首页> 编程资料编程资料
sql数据库批量处理脚本_MsSql_
2023-05-26
538人已围观
简介 sql数据库批量处理脚本_MsSql_
复制代码 代码如下:
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
您可能感兴趣的文章:
相关内容
- 通过分析SQL语句的执行计划优化SQL_MsSql_
- sqlserver 存储过程动态参数调用实现代码_MsSql_
- sqlserver自动增长列引起的问题解决方法_MsSql_
- 小议sqlserver数据库主键选取策略_MsSql_
- SQL语句 一个简单的字符串分割函数_MsSql_
- sqlserver 数据库连接字符串中的可选项收集_MsSql_
- sqlserver 文件数据库和关系数据库的比较_MsSql_
- sqlserver 导出插入脚本代码_MsSql_
- sp_executesql 使用复杂的Unicode 表达式错误的解决方法_MsSql_
- 此数据库没有有效所有者,因此无法安装数据库关系图支持对象_MsSql_
