I have a field like
BestStreet 123/56
and I want to get
BestStreet
I've tried:
LEFT(sd.UliceCP, CHARINDEX(' ', sd.UliceCP)-1)
I have a field like
BestStreet 123/56
and I want to get
BestStreet
I've tried:
LEFT(sd.UliceCP, CHARINDEX(' ', sd.UliceCP)-1)
You may want to add a space, just in case one does not exist.
For example: Notice the sd.UliceCP+' '
LEFT(sd.UliceCP, CHARINDEX(' ', sd.UliceCP+' ')-1)
Using Substring Also we can get the same
SELECT SUBSTRING(sd.UliceCP,0,CHARINDEX(' ',sd.UliceCP))