Zo Has
Zo Has

Reputation: 13018

Search for comma values inside query?

How can I search for a value say

23,000

on a VARBINARY(MAX) filestream column in SQL Server 2008 R2 ? This won't work

SELECT * FROM dbo.tbl_Files WHERE CONTAINS(SystemFile, '%[23,000]%');

Upvotes: 0

Views: 886

Answers (4)

nirav patel
nirav patel

Reputation: 465

try this one : SELECT * FROM dbo.tbl_Files WHERE cast(SystemFile as varchar) like '%23,000%'

Upvotes: 0

u07ch
u07ch

Reputation: 13692

I think its just you have % and full text search uses *

select
*
from tbl_Files
Where contains(SystemFile, '"*23,000*"')

I have a full text index with phone numbers in it and this works too

select
*
from tbl_Files
Where contains(SystemFile, '0116')

Upvotes: 2

nirav patel
nirav patel

Reputation: 465

Please try this one :

select * from  dbo.tbl_Files where   CAST(SystemFile as int)  like '%23000%'

If you have a VARBINARY datatype for a column then you should have to CAST that value , because it is stored as bianry value in table.

Upvotes: 1

Damith
Damith

Reputation: 63065

SELECT * FROM dbo.tbl_Files WHERE CAST(SystemFile AS NVARCHAR) LIKE '%23,000%'

Upvotes: 2

Related Questions