May 13, 2009 at 4:32 am
Hi
I have data which is like 'o_corner',
I have used the below query but all the records which start with 'O' are coming
select * from General_Info where first_name like 'o_%'
Please help me
May 13, 2009 at 4:38 am
Use 'escape'
select * from General_Info where first_name like 'o!_%' escape '!'
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537May 13, 2009 at 4:45 am
Not working 🙁
May 13, 2009 at 4:48 am
Can you supply some sample data? This appears to work
declare @General_Info table(first_name varchar(10))
insert into @General_Info(first_name)
select 'o_corner' union all
select 'other' union all
select 'x'
select * from @General_Info where first_name like 'o!_%' escape '!'
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537May 13, 2009 at 5:04 am
Hey, I am sorry, I have executed in wrong database, Now I have corrected. Its absolutely working fine.
Thank you so much!!!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply