In SSIS, Hoew to assign a value to the variable? -
i have sql query in have mentioned @result
. want assign value of @result
declared variable in execute sql task
of dft. please assist me?
here query:
declare @result smallint declare @value smallint begin set @value = (select value dbo.ldmstockintegritycheck interfacename = 'i0180' , filename = 'piz.ed.nbfs001.picsht.data.ldm') set @result = 0; if (@value = 1) begin select @result = count(*) dbo.ldmintegrityerrorlog interfacename = 'i0180' , filename = 'piz.ed.nbfs001.picsht.data.ldm' , convert(varchar(10), datetime, 120) = convert(varchar(10), getdate(), 120); end end
if want output
value of count
query count(*) dbo.ldmintegrityerrorlog
don't see importance of variable @result
declare @value smallint begin set @value = (select value dbo.ldmstockintegritycheck interfacename = 'i0180' , filename = 'piz.ed.nbfs001.picsht.data.ldm') if (@value = 1) begin select count(*) result dbo.ldmintegrityerrorlog interfacename = 'i0180' , filename = 'piz.ed.nbfs001.picsht.data.ldm' , convert(varchar(10), datetime, 120) = convert(varchar(10), getdate(), 120); end else select null result end
remove variable @result
in query
now create variable taskresult
of data type int
.map variable result
above query.
Comments
Post a Comment