I have this T-SQL script:
DECLARE @idoc int
DECLARE @doc nvarchar(200)
SET @doc ='<ArrayOfString>
<string>AL</string>
<string>DZ</string>
</ArrayOfString>'
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc;
select *
FROM OPENXML (@idoc, '/ArrayOfString',2)
WITH (string varchar(50))
EXEC sp_xml_removedocument @idoc
This is a stored procedure. I send to it some serialized xml (in this variant I declare it as hard code).
I want to get all <string> element's values. In this variant it must be: AL and DZ, but I get only 'AL'. What is it incorrect in my script?