Msg 206, Level 16, State 2, Line 6 Operand type clash: int is incompatible with xml

Error:

Msg 206, Level 16, State 2, Line 6
Operand type clash: int is incompatible with xml

This error comes up when you try to set XML variable with an int value.

Sample Code:
[sql]
DECLARE @Var1 XML
DECLARE @Var2 INT

SET @Var2 = 1

SELECT @Var1 = @Var2
[/sql]

When you execute the above code you get this error at line 6
SELECT @Var1 = @Var2

Fix:
Check all the XML related variables, columns in the table, Arguments to stored procedure, function etc…
and validate if the correct XML value is set.

Applicable to SQL Server 2000,SQL Server 2005,SQL Server 2008,SQL Server 2008 r2,SQL Server 2012, SSIS

Leave a Reply

Your email address will not be published. Required fields are marked *