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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Please help me

Author  Topic 

vidhya
Posting Yak Master

108 Posts

Posted - 2008-07-17 : 07:49:49
Hi,

if the column contains the values as
Grand xx
Grand DTO
Grand PBT
Celio
Mark

i like to get the result as
Grand
Celio
Mark

wat to do?


elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-07-17 : 07:50:47
so just the 1st word? i.e. everything before a space

Em
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-07-17 : 07:54:03
select left(urColumn,charindex(' ',urColumn + ' ',1))


Em
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-17 : 08:36:57

select distinct rtrim(left(urColumn,charindex(' ',urColumn + ' ',1))) from urtable


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-07-17 : 08:59:56
continued here apparently....
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=106809

Em
Go to Top of Page
   

- Advertisement -