July 24, 2012 at 3:59 am
Hi ALL,
I have the below sql script and need to use Execute SQL task in SSIS package to run this
----Script---
declare @status varchar(10), @ErrorMsg nvarchar(max)
exec dbo.p_check_available 'NLD', @status output
If @status = 'INVALID' or @status is NULL
begin
select @ErrorMsg = 'Data Not available'
insert into t_Log_Table
(Status, Description, DateCre, UserCre)
values
('INVALID',@ErrorMsg, GETDATE(), SUSER_SNAME())
raiserror ( @ErrorMsg , 17, 127)
return
end
---end---
Like this I have many SQL scripts in my package.
I am declaring the @status variable in Package level.Is that correct?
I am new to SSIS Execute SQL task,Please help me on this.
July 24, 2012 at 4:02 am
Sorry,there is a mistake in my Topic: How to use Execute SQL task for my SQL Script 😉
July 26, 2012 at 3:38 pm
Your SQL script will run as is so it is unclear what you are trying to accomplish. You mentioned you created a variable at the package level with the same name as a variable in your SQL script, but what is it that you wanted to happen with it?
Best guess you are either wanting to map the value of the variable into the statement in the Execute SQL Task, or you want a variable value to be mapped from your SQL into the variable. Either way this article may be able to help explain how to do that. It depends on your what type of connection you're using, e.g. ADO.NET, OLE DB, etc:
Map Query Parameters to Variables in an Execute SQL Task
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply