Return a value from a SQL script

More
4 years 7 months ago #21473 by ae
Hi

AETLE 6.3.7.18
SQL Server 2017

I'm trying to create a step in a package which runs a SQL script that gets a single value (MAX(id) from a_table) and I want to store that value in a package variable for use in a subsequent step in the package.
I've looked in the docs and searched in the forums but can't see how to achieve this.
Could you advise please?
Due to the distributed nature of the application I need to query a table on one DB server and then use that value to update a table on another DB server. If it is possible to do that in a single SQL script then that would remove the need for storing the value in a package variable but I don't think a single script could have more than 1 DB connection could it?

Thanks

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

More
4 years 7 months ago - 4 years 7 months ago #21479 by admin
You must use two separate connections to achieve your goal. We will create a working example for you

Mike
ETL Architect
Last edit: 4 years 7 months ago by admin.

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

More
4 years 7 months ago - 4 years 7 months ago #21481 by Peter.Jonson
Good afternoon Sir

Since you want just one variable "SQL data check action" would be the easiest option for you
/wiki/advanced-etl-processor/packages/actions/sql-data-check-action/

Otherwise use set variable action
/wiki/advanced-etl-processor/packages/actions/set-variable-action/

Here are some screenshots for you






Please keep us posted on your progress

Peter Jonson
ETL Developer
Last edit: 4 years 7 months ago by Peter.Jonson.

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

More
4 years 7 months ago #21487 by ae
Replied by ae on topic Return a value from a SQL script
Hi Peter

The SQL data check worked perfectly.
Thank you for your help
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