question

Nixxienic avatar image
Nixxienic asked

Using LIKE filter in SQL

Hello, I'm really new to SQL so please feel free to laugh at my ridiculous question. I am more than proficient with VBA and thought it would translate, however it doesn't always seem to be the case. I have built a view and in it I need to filter by LIKE 'appropriate'. I have tried a variety of different ways and it keeps giving me NULL results, which isn't true because I exported to Excel and can see several results there. I would be grateful if you could advise. At the moment it looks like this (cant include all statement due to data protection stuff) WHERE (ARCHV_FLAG = N'n') AND (CREATE_DTTM > CONVERT(DATETIME, '2014-04-01 00:00:00', 102)) AND (DIM_LOOKUP_CASNT_TYPE_ID_DESC = N'case note') AND (TITLE = N'LIKE APPROPRIATE') I realise this is probably simple, but I am getting more than a little frustrated at it not working and would be really grateful if someone could help! Thanks in advance Nic (hopelessly new to all this)
viewlikefilter
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Kev Riley avatar image
Kev Riley answered
Do you mean ... AND Title like '%appropriate%' in other words, are you searching for an occurrence of 'appropriate' in the Title column?
10 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi, yes thats exactly what I am looking for. It just doesnt seem to return the results when I do that.
0 Likes 0 ·
Unfortunately that hasn't worked, it tells me that it can't Parse. Is there anyway around this?
0 Likes 0 ·
Please post your updated WHERE clause.
0 Likes 0 ·
WHERE (ARCHV_FLAG = N'n') AND (CREATE_DTTM > CONVERT(DATETIME, '2014-04-01 00:00:00', 102)) AND (DIM_LOOKUP_CASNT_TYPE_ID_DESC = N'case note') AND (TITLE LIKE N'%APPROPRIATE%')
0 Likes 0 ·
and when you say "it tells me it can't Parse" what does? What is the error message? And what application are you using to type this SQL query ?
0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.