如何在openquery SQL中使用replace?
我需要使用 OpenQuery 从链接服务器中删除特殊字符。
这是示例,但它不起作用
DECLARE @Query VARCHAR(MAX)
SET @Query =
'
UPDATE OPENQUERY
(
LINKEDSERVER,
''SELECT * FROM TABLE WHERE NAME Like ''''' + '%###%' + '''''''
)
SET NAME = REPLACE(NAME, ''###'', '''')
'
EXEC (@Query)
I need to remove Special characters from columns which has them from linked server using OpenQuery.
Here is the example, but it's not working
DECLARE @Query VARCHAR(MAX)
SET @Query =
'
UPDATE OPENQUERY
(
LINKEDSERVER,
''SELECT * FROM TABLE WHERE NAME Like ''''' + '%###%' + '''''''
)
SET NAME = REPLACE(NAME, ''###'', '''')
'
EXEC (@Query)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题似乎与您尝试使用的代码不匹配。您尝试清理的列是链接服务器上表中的值吗?
那么也许这就是您所寻找的:
Your question does not seem to match the code you're trying to use. Are the columns you're trying to clense of values in a table on a linked sever?
Then maybe this is what your looking for: