query

I have data like this

XXXX
XXXX DESC
YYYYY TEXT
ZZZZZZZZ TREWW

I want out as below

XXXX
XXXX
YYYYY
ZZZZZZZZ

I want query for above using sqlserver 2005
knaren1975Asked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
you mean, take all until first space, if any?
select left(yourfield, charindex(' ', yourfield + ' ') - 1) from yourtable

Open in new window

0
 
knaren1975Author Commented:
Great it worked
0
All Courses

From novice to tech pro — start learning today.