Tengo el siguiente Stored Procedure que quiero modificar para que tome los valores que estan entre comillas(ejemplo:strProdDesc = 'PPP_PRODUCTO',)de una Tabla, para que al modificar los valores no tenga que modificar el StPr. El Stored no lo hice yo, solo quiero modificarlo y no tengo mucha idea de Procedimientos Almacenados (creo que con un cursor podria hacerlo pero no se bien como)
Alguien me puede ayudar?
ALTER PROCEDURE [dbo].[NombreSP]
@strPeriod char(6)
AS
drop table #Tracker
select
datPeriod = dbo.fn_Periods(f3),
Country = dbo.fn_CountryDesc(f3),
strProdDesc = 'PPP_PRODUCTO',
Format_data = 'Tipo Envio',
Files = [ims file express tracker],
--Description = [F3],
intClieCod = c.sold_to_party,
c.strClieDesc,
casilla = left(f5,charindex('(',f5)-1),
entregado = f8, intIdRow, strFilename, strFileUser
into #Tracker
from dbo.dlv_FileTracker ft
left outer join dbo.dlv_ContactMaster cm on left(f5,charindex('(',f5)-1) = cm.[E-mail Address]
inner join dbo.dlv_ClientMaster c on cm.intClieId = c.intClieId
where ([F3] like '%DDDPL%' and not ([F3] like '%FF%')) and not(f5 like '%alth%')
union all
select
datPeriod = dbo.fn_Periods(f3),
Country = dbo.fn_CountryDesc(f3),
strProdDesc = 'AR_D',
Format_data = 'Flat Files',
Files = [ims file express tracker],
--Description = [F3],
intClieCod = c.sold_to_party,
c.strClieDesc,
casilla = left(f5,charindex('(',f5)-1),
entregado = f8, intIdRow, strFilename, strFileUser
from dbo.dlv_FileTracker ft
left outer join dbo.dlv_ContactMaster cm on left(f5,charindex('(',f5)-1) = cm.[E-mail Address]
inner join dbo.dlv_ClientMaster c on cm.intClieId = c.intClieId
where ([F3] like '%DDPL%' and [F3] like '%Flat File%') and not(f5 like '%alth%')
union all
select
datPeriod = dbo.fn_Periods(f3),
Country = dbo.fn_CountryDesc(f3),
strProdDesc = 'AR_IMR',
Format_data = 'Amb Plus',
Files = [ims file express tracker],
--Description = [F3],
intClieCod = c.sold_to_party,
c.strClieDesc,
casilla = left(f5,charindex('(',f5)-1),
entregado = f8, intIdRow, strFilename, strFileUser
from dbo.dlv_FileTracker ft
left outer join dbo.dlv_ContactMaster cm on left(f5,charindex('(',f5)-1) = cm.[E-mail Address]
inner join dbo.dlv_ClientMaster c on cm.intClieId = c.intClieId
where ([F3] like '%IMPL%') and not(f5 like '%alth%')
union all
select
datPeriod = dbo.fn_Periods(f3),
Country = dbo.fn_CountryDesc(f3),
strProdDesc = 'AR_NETW',
Format_data = 'Amb Plus',
Files = [ims file express tracker],
--Description = [F3],
intClieCod = c.sold_to_party,
c.strClieDesc,
casilla = left(f5,charindex('(',f5)-1),
entregado = f8, intIdRow, strFilename, strFileUser
from dbo.dlv_FileTracker ft
left outer join dbo.dlv_ContactMaster cm on left(f5,charindex('(',f5)-1) = cm.[E-mail Address]
inner join dbo.dlv_ClientMaster c on cm.intClieId = c.intClieId
where ([F3] like '%INETW%') and not(f5 like '%alth%')