Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Question

Status
Not open for further replies.
Sep 21, 2004
1
US
I really do not use SQL too often, I write in a different language required by the software, but it also allows SQL. I can not find a function in the specific language to do what I need so I was wondering if someone could help. I have a group of data that looks like this

John Smith & Laura Klein Walker
Joseph & Emily Hill

And so on...

I need to seperate the different names into their own attribute or entity.

Ex.
John = FirstName
Smith = LastName
Laura = Spouse
Walker = LastName2

How could I do that?
Thanks In Advance!
 
looking at the two examples you give above it will be almost impossible - if the whole line contained something reasonably standard i.e. firstname lastname you could use patindex to find the spaces and then cut the field to those spaces - however as I said the examples you give would not allow this even ignoring the & in the field.



[bandito] [blue]DBomrrsm[/blue] [bandito]
 
I agree, it would be very difficult.
You could use patindex to split the 2 peoples names into 2 fields, and then from there you would have to treat each one seperatly to find out if there was a lastname or not, and if now to deal with it as needed.

Denny

--Anything is possible. All it takes is a little research. (Me)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top