I have following problem:DECLARE @x XMLSET @x = '<MainNode> <Subnode Atrr1 = "1" /> <Subnode Atrr1 = "2" /> <Subnode Atrr1 = "3" /> <Subnode Atrr1 = "4" /></MainNode>'DECLARE @max INT, @i INT, @atrValue intSELECT @max = @x.query('<e> { count(/MainNode/Subnode) } </e>').value('e[1]','int')SET @i = 1WHILE @i <= @maxBEGINSET @atrValue = @x.value('(/MainNode/Subnode/@Atrr1)[sql:variable("@i")]', 'int') // here is the problemPRINT @atrValueIF @atrValue = 1 // do somethingENDsql:variable("@i") - it doesn't workthe error message isXQuery [value()]: 'value()' requires a singleton (or empty sequence), found operand of type 'xdt:untypedAtomic *'When I type static number e.g. 2 the output is2222
But I want1234
If you know how to solve this problem please help me.Thank you