Click here to Skip to main content
15,887,428 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 13-Jan-18 5:32am
Comments
Richard Deeming 10-Jan-18 13:20pm    
Show us what you've tried, and provide the full error message.

1 solution

I'm not sure, but it sounds like you're having problems with quotes. For example, this isn't valid:
SQL
select foo from bar where baz='I'm not sure'
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.
SQL
select foo from bar where baz='I''m not sure'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900