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 - 2014-11-19 : 07:33:26
|
Strangely i cannot find an example. Just lead and trail spaces.I did this but it does seem to work:where CHARINDEX(' ', m.member_cardNumber) >0Or with '' or where patindex(' ',m.member_cardNumber) > 0 |
|
sz1
Aged Yak Warrior
555 Posts |
Posted - 2014-11-19 : 09:11:38
|
select CHARINDEX(' ', 'm.member_card Number') 'find position'Result postition 14select CHARINDEX('_', 'm.member_cardNumber') 'find position'Result postition 9We are the creators of our own reality! |
|
|
sapator
Constraint Violating Yak Guru
462 Posts |
Posted - 2014-11-19 : 10:53:59
|
Sorry i don't want to find the position, i just need to know how many records have empty spaces in front, between or at the end.Thanks. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-11-19 : 11:50:40
|
WHERE m.member_cardNumber LIKE '% %'Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
sapator
Constraint Violating Yak Guru
462 Posts |
Posted - 2014-11-19 : 18:07:06
|
Ow, it is simple?Will check it tomorrow.Thanks. |
|
|
sapator
Constraint Violating Yak Guru
462 Posts |
Posted - 2014-11-20 : 04:52:41
|
Yep, works,Will also work now with select * from cognetic_members_card where patindex('% %',card_cardNumber) > 0Thanks. |
|
|
|
|
|