SELECT *
FROM dbo.tbl_TMP_RPC_OPRContacts
WHERE FSPro_UserID=0
INSERT INTO dbo.tbl_FSPro_Members(OwnerID,FSL_TableCode,FirstName,LastName,Title,
Organization,OrgID,OrgType,Email,
Phone,PhoneExt,Fax,CellAreaCode,CellPhone,
Address1,Address2,City,State,ZipCode,LoginEnabled,CountryID,
caRelationshipRank,caJobFunction,createDate,Comments)
VALUES(1,'MFR','#Left(trim(select.contactname),40)#','#Left(trim(select.contactLastName),40)#','#Left(trim(select.contacttitle),75)#',
'#Left(trim(select.Organization),75)#',#val(select.OperatorID)#,'OPR','#Left(trim(select.contactemail),75)#',
'#Left(trim(select.ContactPhone),30)#','#Left(trim(select.contactphoneext),12)#','#Left(trim(select.ContactFax),30)#','#Left(trim(select.CellAC),3)#','#Left(trim(select.cellphone),30)#',
'#Left(trim(select.contactaddress_1),75)#','#Left(trim(select.contactaddress_2),75)#','#Left(trim(select.contactCity_1),25)#','#Left(trim(select.contactstate),5)#','#Left(trim(select.contactzip),10)#',0,27,
#val(select.caRelationshipRank)#,#val(select.caJobFunction)#,#CreateODBCDateTime(Now())#,'#Left(trim(select.note),500)#')
SELECT max(FSPro_UserID) AS newid
FROM tbl_FSPro_Members
WHERE OwnerID=1
AND FSL_TableCode='MFR'
AND LastName='#Left(trim(select.contactLastName),40)#'
AND FirstName='#Left(trim(select.contactname),40)#'
UPDATE tbl_TMP_RPC_OPRContacts
SET FSPro_UserID=#get.newid#
WHERE uniqueid=#select.uniqueid#