Answered by:
nesting quotes around a value

Question
-
I am trying to edit this XML containing a SQL statement. I get an error: "Required whitespace is missing"
Apparently it is seeing the quote before the SELECT as ending at the 'A549 and then doesn't understand the rest of the statement. I would normally nest two single quotes but doesn't seem to work in this case.
<z:row AorB='B' OrderIndex='6' SQLStatement='SELECT [Bill to acct #] AS GroupField, Count(*) AS CountTran, Sum([Net TN]) AS SumTons
FROM [Transactions]
WHERE [Transaction Type]!=16 AND [Date Out]>GetDate()-1 AND [Bill to acct #]='A549'
GROUP BY [Bill to acct #]
ORDER BY [Bill to acct #];'
Description='Ace' Values='A549' />Can anyone offer suggestions on how to resolve it ?
thanks
Monday, December 7, 2015 11:13 PM
Answers
-
Hi JManWM,
Based on my research, the error might be caused by that two single quotes are used in the value of SQLStatement attribute. Single-quote character (') can’t be embed into a string which is already single-quoted, there is a blog for your reference.
Please change your xml statement as below and then check if the issue persists.
<z:row AorB='B' OrderIndex='6' SQLStatement='SELECT [Bill to acct #] AS GroupField, Count(*) AS CountTran, Sum([Net TN]) AS SumTons FROM [Transactions] WHERE [Transaction Type]!=16 AND [Date Out]>GetDate()-1 AND [Bill to acct #]=”A549” GROUP BY [Bill to acct #] ORDER BY [Bill to acct #];' Description='Ace' Values='A549' />
For more information of using quotes to indicate attributes in xml , please refer to attribute and article.
Regards,
Ice FanIce Fan
TechNet Community Support- Proposed as answer by Saeid Hasani Tuesday, December 8, 2015 2:42 PM
- Marked as answer by Lydia ZhangMicrosoft contingent staff Thursday, December 17, 2015 7:47 AM
Tuesday, December 8, 2015 1:01 PM -
See
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/02/19/understanding-single-quotes.aspx
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page- Proposed as answer by Saeid Hasani Tuesday, December 8, 2015 2:42 PM
- Marked as answer by Lydia ZhangMicrosoft contingent staff Thursday, December 17, 2015 7:47 AM
Tuesday, December 8, 2015 1:09 PMAnswerer
All replies
-
Hi JManWM,
Based on my research, the error might be caused by that two single quotes are used in the value of SQLStatement attribute. Single-quote character (') can’t be embed into a string which is already single-quoted, there is a blog for your reference.
Please change your xml statement as below and then check if the issue persists.
<z:row AorB='B' OrderIndex='6' SQLStatement='SELECT [Bill to acct #] AS GroupField, Count(*) AS CountTran, Sum([Net TN]) AS SumTons FROM [Transactions] WHERE [Transaction Type]!=16 AND [Date Out]>GetDate()-1 AND [Bill to acct #]=”A549” GROUP BY [Bill to acct #] ORDER BY [Bill to acct #];' Description='Ace' Values='A549' />
For more information of using quotes to indicate attributes in xml , please refer to attribute and article.
Regards,
Ice FanIce Fan
TechNet Community Support- Proposed as answer by Saeid Hasani Tuesday, December 8, 2015 2:42 PM
- Marked as answer by Lydia ZhangMicrosoft contingent staff Thursday, December 17, 2015 7:47 AM
Tuesday, December 8, 2015 1:01 PM -
See
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/02/19/understanding-single-quotes.aspx
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page- Proposed as answer by Saeid Hasani Tuesday, December 8, 2015 2:42 PM
- Marked as answer by Lydia ZhangMicrosoft contingent staff Thursday, December 17, 2015 7:47 AM
Tuesday, December 8, 2015 1:09 PMAnswerer