Site icon Database Tutorials

Argument data type xml is invalid for argument 1 of like function

 

ERROR MESAGGE:

“Argument data type xml is invalid for argument 1 of like function”

EXPLANATION:

You may encounter an error when you query an XML field using the LIKE operator.

SOLUTION:

For example, suppose you have a table named “Books” with fields such as “CategoryID INT”, “PublishingHouse NVARCHAR (70)”, “Book XML”.

You will encounter this error if you run a query in this table as follows:

Because you cannot directly query the XML column with the LIKE operator.

 

To run the query without error, you can convert the XML column to NVARCHAR:

Exit mobile version