Question : Can we create a SSIS package such that it verifies a Sql statement and depend upon that statement the package should execute if the sql statement  does not satisfy then the package should not exe

Can we create a SSIS package such that it verifies a Sql statement and depend upon that statement the package should execute if the sql statement
does not satisfy then the package should not execute.


Answer : Can we create a SSIS package such that it verifies a Sql statement and depend upon that statement the package should execute if the sql statement  does not satisfy then the package should not exe

OK,

I talk about each step separately:
1- use an Execute SQL Task as I said above . let's me get in details here:
add an execute sql task
double click on it
in General tab
set an OLE DB connection
write this in SQLStatement:
select value from yourtable

under Result Set
set ResultSet with Single row

in Result Set tab
click on Add button
set Result Name as :  value
set variable Name as :  @Value

remember that you should declare a package variable named Value with type Int32 before this.

2- you can use another execute sql task for this too. like step 1 . the step 1 will fill value in the @Value package variable for example.

3- again execute sql task for updates

4- you can use data flow task for this step with a source and destination

5- use a data flow task for this one too

6- use a new Execute SQL task.
like step 1, difference is:
set ResultSet as None
set SQLStatement as this:
insert into myTable(Field1) values ( ? )
note this question mark here, this is marker of a parameter
now you should go to Parameter Mapping tab
add a row
with variable name @Value , and parameter Name : 0
set parameter name to 0 is important
if you have other parameters in your query ,  you should use more question marks. and set them starting with parameter name 0 ,1,2... in parameter mapping tab

7- use a data flow task , souce : OLE DB Source with the table selected
destination: every destination you want, for example text file or excel or ....


let me know where is ambigous to you.
Regards,
OK,


Random Solutions  
 
programming4us programming4us