Re: How to split a name field and write to Lname + Fname
From: Adam Machanic (amachanic_at_hotmail._removetoemail_.com)
Date: 09/17/04
- Next message: -D-: "Re: data type error in my query"
- Previous message: Adam Machanic: "Re: Query Question"
- In reply to: Pancho: "How to split a name field and write to Lname + Fname"
- Next in thread: Pancho: "Re: How to split a name field and write to Lname + Fname"
- Reply: Pancho: "Re: How to split a name field and write to Lname + Fname"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Sep 2004 19:05:26 -0400
You can try:
SELECT LEFT(YourCol, CHARINDEX(',', YourCol) - 1) AS LName,
RIGHT(YourCol, LEN(YourCol) - CHARINDEX(',', YourCol) - 1) AS FName
FROM YourTable
"Pancho" <Pancho@discussions.microsoft.com> wrote in message
news:67313945-238A-416A-A5F0-4934C4494352@microsoft.com...
> I have a table EmployeeOffice with a field [Employee Name]. Values in
that
> field are like Smith, John, always separated by a comma. How can I read
the
> string up to (and excluding) the comma, store that value and SET my new
field
> Lname to be the value, and then move one space past the comma to collect
the
> remainder and SET my new field Fname to be the first-name string value?
> Thanks!
- Next message: -D-: "Re: data type error in my query"
- Previous message: Adam Machanic: "Re: Query Question"
- In reply to: Pancho: "How to split a name field and write to Lname + Fname"
- Next in thread: Pancho: "Re: How to split a name field and write to Lname + Fname"
- Reply: Pancho: "Re: How to split a name field and write to Lname + Fname"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|