将xquery命令作为varchar传递 [英] Passing xquery command as varchar

查看:77
本文介绍了将xquery命令作为varchar传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请让我知道将以下命令(包括column.value)作为varchar传递给select查询命令的方法



column.value('declare namespace xc =value;(// xc:value1/ xc:childnode1 / xc:childnode2)[1] / @ val1','varchar(200)')



我尝试了什么:



我尝试了几种方法 - 但仍然出现语法错误

Please let me know the way to pass the below command (including column.value) as varchar to the select query command

column.value('declare namespace xc="value";(//xc:"value1"/xc:childnode1/xc:childnode2)[1]/@val1', 'varchar(200)')

What I have tried:

I have tried several ways - but still getting syntax error

推荐答案

我不确定,但听起来你的报价有问题。例如,这是无效的:
I'm not sure, but it sounds like you're having problems with quotes. For example, this isn't valid:
select foo from bar where baz='I'm not sure'

单引号在SQL中分隔一个字符串,因此如果你想要一个带单引号的字符串,你必须通过加倍单引号来转义它们。

Single quotes delimit a string in SQL, so if you want a string with single quotes in it, you must escape them by doubling the single quotes.

select foo from bar where baz='I''m not sure'


这篇关于将xquery命令作为varchar传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆