ImportOdbcQuery Script Examples: Difference between revisions
Jump to navigation
Jump to search
(403051) |
No edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This page contains script examples for the [[ | This page contains script examples for the [[SQL Scripting Commands#--.23ImportOdbcQuery|ImportOdbcQuery]] script command. | ||
The following script extracts data from an ODBC | The following script extracts data from an ODBC connection to QPR ProcessAnalyzer database and selects all columns from the table PA_MODEL. | ||
<pre> | <pre> | ||
(SELECT 'OdbcConnectionString', 'DSN=PA_EXPRESS_40') UNION ALL | (SELECT 'OdbcConnectionString', 'DSN=PA_EXPRESS_40') UNION ALL | ||
Line 10: | Line 10: | ||
</pre> | </pre> | ||
The following is the same command as the previous, except instead of a plaintext connections string (which might contain a password), the connections string is stored as a [[Storing_Secrets_for_Scripts|secret]] with name ''MySecureConnectionString'': | |||
<pre> | |||
(SELECT 'OdbcConnectionStringKey', 'MySecureConnectionString') UNION ALL | |||
(SELECT 'OdbcQueryString', 'SELECT * FROM PA_MODEL') UNION ALL | |||
(SELECT 'TargetTable', '#ImportOdbcTable') UNION ALL | |||
(SELECT 'Append', '1') | |||
--#ImportOdbcQuery | |||
</pre> | |||
[[Category:Examples]] | [[Category:Examples]] |
Latest revision as of 12:53, 18 January 2024
This page contains script examples for the ImportOdbcQuery script command.
The following script extracts data from an ODBC connection to QPR ProcessAnalyzer database and selects all columns from the table PA_MODEL.
(SELECT 'OdbcConnectionString', 'DSN=PA_EXPRESS_40') UNION ALL (SELECT 'OdbcQueryString', 'SELECT * FROM PA_MODEL') UNION ALL (SELECT 'TargetTable', '#ImportOdbcTable') UNION ALL (SELECT 'Append', '1') --#ImportOdbcQuery
The following is the same command as the previous, except instead of a plaintext connections string (which might contain a password), the connections string is stored as a secret with name MySecureConnectionString:
(SELECT 'OdbcConnectionStringKey', 'MySecureConnectionString') UNION ALL (SELECT 'OdbcQueryString', 'SELECT * FROM PA_MODEL') UNION ALL (SELECT 'TargetTable', '#ImportOdbcTable') UNION ALL (SELECT 'Append', '1') --#ImportOdbcQuery