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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql Sytax help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am havet to concatinate a name into first and last name, here is the syntax I have tried. Any help would be greatly appreciated.

Thanks

UPDATE L3_LKUP_VPNAME SET L3_LKUP_VPNAME.VPFNAME = Mid(L3_LKUP_VPNAME.LKUP_DESC,1,InStr(1,L3_LKUP_VPNAME.LKUP_DESC," ")-1)
WHERE (((L3_LKUP_VPNAME.FNAME) Is Null))
 
It appears that you want to parse the name rather than concatenate. This sample query will parse a column consisting of first and last names separated by spaces and update the FNMAE and LNAME columns with the substrings. Of course, there can be numerous name combinations that you may have to account for but this should allow you to get started.

UPDATE L3_LKUP_VPNAME SET
VPFNAME = LEFT(LKUP_DESC,CHARINDEX(' ',LKUP_DESC)-1),
VPLNAME = RIGHT(LKUP_DESC,datalength(LKUP_DESC)-CHARINDEX(' ',LKUP_DESC))
WHERE VPFNAME Is Null Terry

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top