SQLTeam.com | Weblogs | Forums

EXTRACT String for cell


When I have 'TWO DAYS' in a string i want to extract 'TWO' but if i use this code below and only have 'TWO' in the cell it returns an empty value :

SUBSTRING(fieldname,0,CHARINDEX(' ',fieldname,0)) 

I'ld like to return the first word of every cell ...

Thanks in advance


LEFT(fieldname,CHARINDEX(' ',fieldname + ' ') - 1)


Thanks again Scott :slight_smile: