Hi,I am trying to insert data to a table from an XML file however i get an error in SSMS:DECLARE @xmlDoc XMLSET @xmlDoc =(SELECT * FROM OPENROWSET ( BULK 'D:\Studier\MCTS\ML326C - XML i Relationsdatabaser\Projektfiler\faktura_1.xml', SINGLE_BLOB ) AS xmlData ) SELECT @xmlDoc -- FROM SELECT @xmlDoc.query('/FAKTURA/FÖRETAG/ORGNR'), @xmlDoc.query('/FAKTURA/KÖPARE/FÖRETAGSNAMN') (SELECT anst_id FROM HR.Anställd WHERE @xmlDoc.query('/FAKTURA/KÖPARE/BESTÄLLARE') = fornamn)The error message is:Msg 402, Level 16, State 1, Line 18The data types xml and varchar are incompatible in the equal to operator.
I first thought it was because it was a char(20) column but this gives the same error: SELECT @xmlDoc.query('/FAKTURA/FÖRETAG/ORGNR'), @xmlDoc.query('/FAKTURA/KÖPARE/FÖRETAGSNAMN') (SELECT anst_id FROM HR.Anställd WHERE @xmlDoc.query('/FAKTURA/KÖPARE/BESTÄLLARE') = 'word')Can anyone assist me with this?Best regards,KFluffie