Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
raindear
Yak Posting Veteran
64 Posts |
Posted - 2014-02-06 : 06:41:12
|
I am trying to solve an issue in SQL but am getting this errorThe data types xml and varchar are incompatible in the equal to operator.My Query is fairly long. Any idea how I can resolve this?UPDATE PromotionsSET PromotionDiscountData = '<ArrayOfPromotionRuleBase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><PromotionRuleBase xsi:type="ProductIdPromotionRule"><ProductIds><int>13,16,15215,15223,15225,15227,15231,15261,15266,15267,15272,15274,15276,15277,15288,15289,15290,15292,15293,15297,15299,15316,15329,15336,53787,53788,53789,55872,55873,55874</int></ProductIds><RequireQuantity>true</RequireQuantity><Quantity>1</Quantity><AndTogether>true</AndTogether><ExcludeSaleProducts>false</ExcludeSaleProducts></PromotionRuleBase><PromotionRuleBase xsi:type="SectionPromotionRule"><SectionIds><int>5346</int></SectionIds><ExcludeSaleProducts>true</ExcludeSaleProducts></PromotionRuleBase></ArrayOfPromotionRuleBase>'WHERE PromotionDiscountData = '<ArrayOfPromotionRuleBase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><PromotionRuleBase xsi:type="ProductIdPromotionRule"><ProductIds><int>51925</int></ProductIds><RequireQuantity>true</RequireQuantity><Quantity>1</Quantity><AndTogether>true</AndTogether><ExcludeSaleProducts>false</ExcludeSaleProducts></PromotionRuleBase><PromotionRuleBase xsi:type="SectionPromotionRule"><SectionIds><int>5346</int></SectionIds><ExcludeSaleProducts>true</ExcludeSaleProducts></PromotionRuleBase></ArrayOfPromotionRuleBase>' |
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2014-02-06 : 13:22:19
|
Can you use CONVERT or CAST to transform one data type into the other data type?===============================================================================There are two kinds of light -- the glow that illuminates, and the glare that obscures. -James Thurber (1894-1961) |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-02-06 : 16:21:48
|
UPDATE PromotionsSET PromotionDiscountData = '<ArrayOfPromotionRuleBase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><PromotionRuleBase xsi:type="ProductIdPromotionRule"><ProductIds><int>13,16,15215,15223,15225,15227,15231,15261,15266,15267,15272,15274,15276,15277,15288,15289,15290,15292,15293,15297,15299,15316,15329,15336,53787,53788,53789,55872,55873,55874</int></ProductIds><RequireQuantity>true</RequireQuantity><Quantity>1</Quantity><AndTogether>true</AndTogether><ExcludeSaleProducts>false</ExcludeSaleProducts></PromotionRuleBase><PromotionRuleBase xsi:type="SectionPromotionRule"><SectionIds><int>5346</int></SectionIds><ExcludeSaleProducts>true</ExcludeSaleProducts></PromotionRuleBase></ArrayOfPromotionRuleBase>'WHERE CAST(PromotionDiscountData AS NVARCHAR(MAX)) = N'<ArrayOfPromotionRuleBase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><PromotionRuleBase xsi:type="ProductIdPromotionRule"><ProductIds><int>51925</int></ProductIds><RequireQuantity>true</RequireQuantity><Quantity>1</Quantity><AndTogether>true</AndTogether><ExcludeSaleProducts>false</ExcludeSaleProducts></PromotionRuleBase><PromotionRuleBase xsi:type="SectionPromotionRule"><SectionIds><int>5346</int></SectionIds><ExcludeSaleProducts>true</ExcludeSaleProducts></PromotionRuleBase></ArrayOfPromotionRuleBase>' Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
 |
|
|
|
|
|
|