Quantcast
Channel: SCN : All Content - Data Services and Data Quality
Viewing all articles
Browse latest Browse all 4013

Execute Stored Procedure and then start data extraction from SQL Table

$
0
0

Here the simplest way to execute stored procedure from BODS using In-Build function. You can also try and pass dynamic input to stored procedure.

 

Below the simplest steps to execute stored procedure and then data extraction.

 

1. Create Batch job and insert workflow and Script as like below

 

1.png

2. Use the In-Build function sql() in BODS Script to execute SQL operation in the specified database.

 

Syntax: sql (datastore, sql_command)

 

DataStore: A string containing the name of the datastore where the tables involved in the SQL operation reside. This name is the name you specified when you created the datastore in Data Services. Include this string in single quotation marks.

 

SQL_Command: A string containing the text of the SQL command to execute. This string must be enclosed in single quotation marks ('). If the string contains quoted values, the internal quotation marks must be single quotation marks preceded by the escape character, backslash (\).

 

Example :

DataStore Name: SQL_FI_SRC

Stored Procedure Name: SP_Fill_FITable

1.png

Pass dynamic input to stored procedure:

 

Create Global variable under Batch Job and use the same as stored procedure parameter and pass the value to variable while executing the job, below the example

 

Global Variable:  $CalMonth

DataStore Name: SQL_FI_SRC

Stored Procedure Name: SP_Fill_FITable

Required Parameter : @CalMonth , @Type

 

Assume @calmonth is a dynamic and @Type is default value then use the below script

1.png

Note: This stored procedure will fill the values to the source table.

 

3. Create dataflow to perform data extraction from source table and include under workflow as like below,

 

1.png

4. Execute the Batch Job, Script will execute the stored procedure and fill the value to the source table after that dataflow  will perform the data extraction from source to target table .

 

1.png

Batch Job Execution status Log:

1.png


Viewing all articles
Browse latest Browse all 4013

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>