with teddie as (
select fspro_userId, firstName, lastName, email, ownerId, fsl_tablecode
from tbl_Fspro_members
where email like 'teddie%'
)
select 'CHO' partnerType, cho_id partnerId, cho_name as partnerName, fseContactId
from tbl_CHO_Operators with (nolock)
where fseContactId in ( select fspro_userId from teddie )
union
select 'DST' partnerType, dstId partnerId, dstName as partnerName, fseContactId
from tbl_DST_Distributors with (nolock)
where fseContactId in ( select fspro_userId from teddie )
union
select 'MFR' partnerType, mfr_id partnerId, mfr_name as partnerName, fseContactId
from tblManufacturers with (nolock)
where fseContactId in ( select fspro_userId from teddie )
union
select 'BRO' partnerType, broker_id partnerId, broker_name as partnerName, fseContactId
from tblBrokers with (nolock)
where fseContactId in ( select fspro_userId from teddie )
union
select 'MSC' partnerType, userId partnerId, company as partnerName, fseContactId
from tbl_MSC_FSLibraryUsers with (nolock)
where fseContactId in ( select fspro_userId from teddie )
select ownerId, fsl_tablecode from tbl_FSPRO_Members with (nolock)
where fspro_userId =
select top 1 fspro_userId from tbl_FSPRO_Members with (nolock)
where ownerId =
and fsl_tablecode =
and email =
update tbl_FSPRO_Members
set email =
where fspro_userId =
update #_tableName#
set fseContactId =
where #_partnerIdCol# =
and fseContactId =
delete from tbl_FSPRO_Members
where fspro_userId =