Thursday, March 17, 2011

How "Execute SQL Task Work" ?

#Case 1:Simply execute the SQL query which will return the records:
Steps: Execute SQL Task Editor:----->Result Set(None)-------->SQL Statement --->direct input(select time_key from dw.Dim_Date).
#Case 2:Pass the parameter into the Execute sql task and get the records and store the data in to the result set:
Steps:declare variable which u want to pass here "datechk" .
result set:single Row(it will store the single row)
SQL Statement: write a query

if exists (select 'X' from dw.Dim_Date where date_key = ?)
BEGIN
  select 'True' AS date_key
END
ELSE
BEGIN
select 'False' AS date_key
END
what ever value you want to pass should be represent through (?) question marks.


add the variable in the "parameter mapping" .this variable contains the value which you want to pass.


create the result set Note:the result set name "date_key" should be same in the sql Query.


No comments:

Post a Comment