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 |
|
funketekun
Constraint Violating Yak Guru
491 Posts |
Posted - 2006-11-23 : 16:28:08
|
| declare @table table (tableid int identity(1,1) , t varchar(200))insert @table select 'asdf, adsfa, asdf' union allselect 'asdf, adsfa asdf' union allselect 'asdf, asdf' union allselect 'asdf,adsfa, asdf' union allselect 'asdf adsfa asdf' union allselect 'asdf 453 ldlkd ' union allselect 'asdf asdf - asdf --adsf ' union allselect 'asdf , adsfa, asdf' union allselect 'asdf ,adsfaasdf' union allselect 'asdf adsfasdf,' union allselect ',asdf adsfasdf,' select * from @table where t not like '%,%'how can i select the records which don't have a comma. i dont wanna use a not like because i read its bad for performance. |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2006-11-23 : 18:45:49
|
| You can try:select * from @table where charindex(',',t) < 1In any case you will end up with a full scan of the table,so performance will probably be about the same.rockmoose |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-24 : 04:15:05
|
| orselect * from @table where replace(t,',','') =tMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|