Package Run SQL Script -> Pass output to variable

More
1 year 11 months ago - 1 year 11 months ago #24043 by prashant
Hellos,
let's assume I have a simple SQL script 
Code:
select text_field_02 from event_log where id ='d0c69b20-633a-4863-ad25-14cd3b6c0fb4';

I can run this script in Package using SQL script but how do I pass the output to a variable ? 

These are the ones available from the package but none of them have the output 'suprisingly
'<Current Package Action Name>
<Action Comments>
<Result of Action Execution>
<On Success Execute>
<On Error Execute>
<Execution Status>
<Actual Execution Status>
<Sql Script>
<Sql Script Ignore Errors>
<Sql Script Error>
 
Last edit: 1 year 11 months ago by prashant.
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago - 1 year 2 weeks ago #24044 by admin
Last edit: 1 year 2 weeks ago by admin.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24045 by prashant
Major Brain Freeze moments , can I request for an example?

Is it SQL script or SQL lookup?

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24046 by admin
Default repository has some examples

Select
  '<ContactName>' As VariableName,ContactName As VariableValue
From Customers
where CustomerId='<CustomerId>'
union
Select
  '<ContactTitle>' As VariableName,ContactTitle As VariableValue
From Customers
where CustomerId='<CustomerId>'
union
Select
  '<Email>' As VariableName,Email As VariableValue
From Customers
where CustomerId='<CustomerId>'

Is it SQL script or SQL lookup

It can be any of them

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24048 by prashant
Can you guide me which specific example? I looked at 0097 package number , I can understand that parameters can be passed , but once the sql script runs , how do I 'save the output' to another variable or even display the message?

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24053 by prashant
I am basically trying to read from URL logger and then pass it to URL so I can pass the webhook forward

SO from here 
DECLARE @json NVarChar(max) select top 1 @json=text_field_02 from event_log where id =:sqlparamater;                               SELECT * FROM OpenJson(@json) WITH (   "mobile" VARCHAR(100) '$."{{mobile}}"',   "candidate_ID" VARCHAR(100) '$."{{candidate_id}}"',   "name" VARCHAR(100) '$."{{candidate_name}}"',   "position" VARCHAR(100) '$."{{position}}"',   "ctc" VARCHAR(100) '$."{{ctc}}"',   "join_date" VARCHAR(100) '$."{{join_date}}"',   "join_company" VARCHAR(100) '$."{{join_company}}"',   "referral_type" VARCHAR(100) '$."{{referral_type}}"',   "referral_by" VARCHAR(100) '$."{{referral_by}}"',   "offer_id" VARCHAR(100) '$."{{offer_id}}"' )

I want to simply do 

select text_field_02 from event_log where id =:sql_parameter';

AND

Pass the JSON object forward to HTTP Post , with minor modifications
Select 
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save