Saturday, March 5, 2011

Execute SQL Task


- Using this, we can
--> execute direct T-SQL statements
--> execute parameterized SPs
--> execute .sql file

PROPERTIES


1. Result Set
        - None : When you just want to execute the SP and don't want to store resultset anywhere
        - Single Row : When you want to store 1st row of a resultset in some variables
        - Full Result Set : When you want to store whole resultset in some object variable
2. SQLSourceType
        - Direct Input : When you want to store whole resultset in some object variable
        - File Connection : When you want to store whole resultset in some object variable
        - Variable : When you want to store whole resultset in some object variable
3. SQLStatement
        Here you have to give actual statement

EXAMPLE

1. Executing direct SELECT statement

          SQLSourceType : Direct Input
          SQLStatement : SELECT .......

2. Executing parameterized SP


          SQLSourceType : Direct Input
          SQLStatement : EXEC DemoProc ?,?

          This means SP has 2 parameters



Now if you want to store result set then, you can store SingleRow individually in different variables or whole resultset in 1 single Object variable. 

Storing Single Row


Storing Whole Result set 
       click here





No comments:

Post a Comment