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 |
|
umertahir
Posting Yak Master
154 Posts |
Posted - 2009-05-15 : 06:02:55
|
| How do I filter my records by picking a specific pattern from my CHAR field?Field example: 78Or_Or_FFAMF_L 90Or_Or_FF_1990 91Or_Or_FM_1991 86Or_F1X2F0008 81Or_Or_FFAMF_WI want only those records to be picked which have 'FF' occurring in it. |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-05-15 : 06:11:53
|
| select col1 from table having charindex('FF',col1)>0Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceled |
 |
|
|
umertahir
Posting Yak Master
154 Posts |
Posted - 2009-05-15 : 06:16:36
|
Thanks, I have now put it like this as suggested by you:SELECT chrBlupIDFROM dbo.tblAnimalWHERE CHARINDEX('FF',chrBlupID) > 0quote: Originally posted by senthil_nagore select col1 from table having charindex('FF',col1)>0Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceled
|
 |
|
|
umertahir
Posting Yak Master
154 Posts |
Posted - 2009-05-15 : 06:17:08
|
OR can't i use:SELECT chrBlupIDFROM dbo.tblAnimalWHERE chrBlupID LIKE '%FF%' |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-05-15 : 06:23:11
|
| "Like" may slow down your Query.. Use Where Clause instead of HavingSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceled |
 |
|
|
umertahir
Posting Yak Master
154 Posts |
Posted - 2009-05-15 : 06:45:28
|
Thanks for your help.quote: Originally posted by senthil_nagore "Like" may slow down your Query.. Use Where Clause instead of HavingSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceled
|
 |
|
|
|
|
|