重复删除 48 个字段中的引号
下面的脚本在逐个字段的基础上工作,并删除每个条目开头和结尾的引号,但是如果您有超过 3 或 4 列,复制、粘贴更改到每个新列名称需要大量的时间时间。知道如何让它循环遍历每一列吗?
--Removing quotes back and front from fields where datetime_updated is not blank
UPDATE [Majestic].[dbo].hdiyouth_school_2
SET datetime_updated=left(right(cast(datetime_updated as nVarchar),
LEN(cast(datetime_updated as nVarchar))-1),
LEN(cast(datetime_updated as nVarchar))-2)
WHERE datetime_updated IS NOT NULL AND datetime_updated LIKE '"%"'
This script below works on a field by field basis, and removes the quotes at the beginning and the end of every entry, BUT if you have more than 3 or 4 columns, copying, pasting changing to every new column name takes a huge amount of time. Any idea how to have this perhaps loop through every column?
--Removing quotes back and front from fields where datetime_updated is not blank
UPDATE [Majestic].[dbo].hdiyouth_school_2
SET datetime_updated=left(right(cast(datetime_updated as nVarchar),
LEN(cast(datetime_updated as nVarchar))-1),
LEN(cast(datetime_updated as nVarchar))-2)
WHERE datetime_updated IS NOT NULL AND datetime_updated LIKE '"%"'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以以类似于以下的方式为每列自动生成查询:
You can auto-generate a query for each column, in a manner similar to this: