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 2000 Forums
 SQL Server Development (2000)
 Return the first name

Author  Topic 

Bunks
Starting Member

10 Posts

Posted - 2010-07-25 : 17:44:08
Hi all

I have a query that I think should be easy but my limited sql skills are making it hard for me!

I want to return just the first name for a member in a column in a table - regardless of whether they have a middle name or not.

Example of the data:

John Henry
Steven
Lewis Trevor
Ian

I just want to return:

John
Steven
Lewis
Ian

Halp!

Thanks so much......

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-07-25 : 19:06:04
SELECT Left(myColumn, CharIndex(' ', myColumn + ' ')-1) FROM myTable
Go to Top of Page

Bunks
Starting Member

10 Posts

Posted - 2010-07-25 : 21:17:55
Thanks a lot - I'll try that!
Go to Top of Page
   

- Advertisement -