Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Problem with Like statement using in query

Author  Topic 

joseph2078
Starting Member

1 Post

Posted - 2009-08-19 : 11:11:08
Hi All,

I am using Like statement in the query to retrieve result but the problem is when i am passing value in lower case in the query using like statement in query, it dosen't return record.

Below is the query:

Select * from System where Asset like 'gr%'

Dosen't return record But if i pass

Select * from System where Asset like 'GR%'

then i get the result.

Can you please give me any solution so i can pass value in upper or lower case and it should return result.

Thanks in Advance

Joseph


jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-08-19 : 11:20:58
Select * from System where Asset like 'GR%' or Asset like 'gr%'
Select * from System where UPPER(left(Asset,2)) = 'GR'

Jim
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-19 : 11:22:22
It seems you have a case sensitive collation for the column.
You can do as jimf demonstrated or COLLATE the column on the fly when querying.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-08-19 : 11:33:17
Check this for detailed information

http://vyaskn.tripod.com/case_sensitive_search_in_sql_server.htm
Go to Top of Page
   

- Advertisement -