I'm using SQL Server 2008. In my table I have a column called TestData
of type binary
.
Sample data in TestData column are
1. 0x0001DC780C0030373156635D0C00B8840301009A0600AC
2. 0x0301DC780C0030373156385D0C006499C401009A0600AC
Wrote below two queries to get the rows where TestData starts with "0x0001". But none of them are working.
SELECT *
FROM T_TRANSACTION
WHERE CAST(Indicium AS nvarchar(MAX)) LIKE '0x0001%'
----No results found
SELECT *
FROM T_TRANSACTION
WHERE CAST(Indicium AS nvarchar(MAX)) LIKE '0x0001%'
----Returns all the rows
Please correct the query to get the expected results
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…