Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

how to test for a 2nd space character -- using Case?

$
0
0
create table #tmp1 (fld1 varchar(50))

insert into #tmp1
select 'smith, joe a' union all
select 'jones, steve'

I need to check if there is a 2nd space in a varchar field.  The first row has 2 spaces (' '). The following check attempt is giving me an error:

select case charindex(' ', fld1, charindex(' ', fld1, 1) + 1) > 0 then 'yes', else 'no' end x1 from #tmp1

What is the way to do this?

Thanks


Rich P


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>