Select fullname without familyname

Hello,
I have a table with names

UserTable(UserId int, Fullname(varchar(100))
Data:
UserId=1, Fullname='John Johnson'
UserID=2, Fullname='Bill William Howard'

I want to select Fullname from the table but not the last name.
From the example above I would like to get the result:
UserId=1, Fullname='John'
UserId=2, Fullname='Bill William'

Can you please help me with this?
johnson1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun KlineLead Software EngineerCommented:
Something like this?
DECLARE @Name AS VARCHAR(100)

SET @Name = 'Bill William Howard'

PRINT LEFT(@Name, LEN(@Name) - CHARINDEX(' ', REVERSE(@Name)))

Open in new window

0
Scott PletcherSenior DBACommented:
That's extremely complex to do.  Search the web for some code that already has some of the issues with doing that identified and addressed.

For example:

'John Johnson II'
'Dr. Bill Watson'
'Manuel A. Pérez Quiñones'
0
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Werver Von Braun
Jean-Claude Van Damme
Charles de Gaulle
Karl Heins und Zu der Gossinger
0
Scott PletcherSenior DBACommented:
Claus Philipp Maria, Schenk Graf von Stauffenberg
0
Vitor MontalvãoMSSQL Senior EngineerCommented:
That's why usually is a separated field for LastName.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.