Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

LIKE clause is not working for perticular varbinary SQL column

$
0
0

I'm executing following SQL query in SharePoint foundation 2010 content database. The records are not returned with following SQL query with LIKE operator.

Select * from AllUserData where tp_ContentTypeId LIKE 0x012000DE1316AEBA6B6345A0DC9DD17928C3A00100C2621E5BF0471941B53888545143450D

In query if I use '=' instead of 'LIKE' then query returns result. The type of  tp_ContentTypeId SQL column is varbinary. The LIKE clause is working for other content type Ids.

Please let me know why above query is not working for 0x012000DE1316AEBA6B6345A0DC9DD17928C3A00100C2621E5BF0471941B53888545143450D value with LIKE clause? Is there something magic numbers in this content type ID cause LIKE clause to fail?

I also tried with inserting data into temp table and select clause as below. But LIKE clause doesn't work for this particular value.

SELECT

'11' as ID, 0x012000DE1316AEBA6B6345A0DC9DD17928C3A00100C2621E5BF0471941B53888545143450D as CTINTO #TempTable



select

*from #TempTablewhere CTLIKE 0x012000DE1316AEBA6B6345A0DC9DD17928C3A00100C2621E5BF0471941B53888545143450D


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>