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:

Ekrem Önsoy
Author: Ekrem Önsoy

The original article was written in Turkish by Ekrem Önsoy and translated to English by dbtut with the consent of the author. The copyright of the article belongs to the author. The author shall not be liable in any way for any defect caused by translation.

Leave a Reply

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