I have generated a FOR XML with the help from this Link. In the solution there is a condition
SELECT
'String' as [Cell/Data/@ss:Type],
[Col1] as [Cell/Data],
'',
'String' as [Cell/Data/@ss:Type],
[Col2] as [Cell/Data],
'',
I want to add a condition to this part which says
SELECT
CASE
WHEN COL1 LIKE '%SUP%'
THEN
'String' as [Cell/ss:Data/@ss:Type]
ELSE
'String' as [Cell/Data/@ss:Type]
END ,
[Col1] as [Cell/Data],
'',
But i am getting issues. Kindly help me with this.
This basic code above showing the Syntax error. If i add
SELECT
CASE
WHEN COL1 LIKE '%SUP%'
THEN
(SELECT 'String' as [Cell/ss:Data/@ss:Type])
ELSE
(SELECT 'String' as [Cell/Data/@ss:Type])
END ,
[Col1] as [Cell/Data],
'','
Then the generated XML is not correct