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.
| Author |
Topic |
|
sapator
Constraint Violating Yak Guru
462 Posts |
Posted - 2008-05-15 : 06:43:07
|
| Hi.Can you tell my if i can use like for multiple results?P.E. I want to find plate numbers that starts with p.e. IDK8883,DFF9999,GGG9043The numbers don't follow a pattern so i cannot use "[]" and such.Also i tried like'FFF3333' or like'TFR2345' etc but it does not work.Any ideas?Thanks. |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-05-15 : 06:50:51
|
quote: Originally posted by sapator Hi.Can you tell my if i can use like for multiple results?P.E. I want to find plate numbers that starts with p.e. IDK8883,DFF9999,GGG9043The numbers don't follow a pattern so i cannot use "[]" and such.Also i tried like'FFF3333' or like'TFR2345' etc but it does not work.Any ideas?Thanks.
declare @test table( names varchar(50))insert into @testselect 'Ravikishore' union allselect 'Johnclifford' union allselect 'Ramesh'select * from @testsuppose u want to find the names containing the word ravi or cliffordthenselect * from @test where names like '%ravi%' or names like '%clifford%'APPLY THE SAME CONCEPT IN YOUR PROBLEM ALSO I.E.,WHERE PLATE NUMBER LIKE '%FFF3333%' OR PLATE NUMBER LIKE '%TFR2345%' |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-05-15 : 06:54:06
|
| [code]where col like '[A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9]%'[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
sapator
Constraint Violating Yak Guru
462 Posts |
Posted - 2008-05-15 : 07:20:06
|
| Hi.Yes or worked, i was just using it wrong. Thanks!Also i cannot make harsh_athalye code to work.I put carno like '[DFD5530][TYG9255]' but it does not return any results |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-05-15 : 08:13:06
|
| Of course it wont work that way!Why didn't you tried exactly the way I given you?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
sapator
Constraint Violating Yak Guru
462 Posts |
Posted - 2008-05-16 : 07:19:51
|
| And will this do?'[A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9]%'i just want specific car license numbers.Thanks. |
 |
|
|
|
|
|