ImportSqlQuery Script Examples: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
This page contains script examples for the [[QPR ProcessAnalyzer Scripting Commands#--.23ImportSqlQuery|ImportSqlQuery]] script command.
This page contains script examples for the [[SQL Scripting Commands#--.23ImportSqlQuery|ImportSqlQuery]] script command.


The following example will load data from an ADO.NET source (a sample database called DB1 on Microsoft SQL Server) and select all columns from the table EXAMPLE. It will then put that data into the "#TABLE" temporary table, and then show the contents of that table.
The following example will load data from an ADO.NET source (a sample database called DB1 on Microsoft SQL Server) and select all columns from the table EXAMPLE. It will then put that data into the "#TABLE" temporary table, and then show the contents of that table.

Latest revision as of 20:52, 25 October 2021

This page contains script examples for the ImportSqlQuery script command.

The following example will load data from an ADO.NET source (a sample database called DB1 on Microsoft SQL Server) and select all columns from the table EXAMPLE. It will then put that data into the "#TABLE" temporary table, and then show the contents of that table.

(SELECT 'SqlConnectionString', 'Data Source=(local);Initial Catalog=DB1;Integrated Security=true') UNION ALL
(SELECT 'SqlQueryString', 'SELECT * FROM EXAMPLE') UNION ALL
(SELECT 'TargetTable', '#TABLE') UNION ALL
(SELECT 'Append', '1')
--#ImportSqlQuery

(SELECT * FROM #TABLE) 
(SELECT 'MaximumCount', '0') 
--#ShowReport 

The following example will load all the columns from "EXAMPLE" table in SQL Server database and will put that data into the "ExampleDataTable" in the "ExampleProject" project. It will then get the Data Table analysis from the "ExampleDataTable", put that into the "#TABLE" temporary table and then show the contents of that table.

(SELECT 'ProjectName', 'ExampleProject') UNION ALL 
(SELECT 'DataTableName', 'ExampleDataTable') UNION ALL 
(SELECT 'Append', '0') UNION ALL 
(SELECT 'SqlConnectionString', 'Data Source=(local);Initial Catalog=DB1;Integrated Security=true') UNION ALL 
(SELECT 'SqlQueryString', 'SELECT * FROM EXAMPLE')
--#ImportSqlQuery

(SELECT 'AnalysisType', '18') UNION ALL 
(SELECT 'ProjectName', 'ExampleProject') UNION ALL 
(SELECT 'MaximumCount', '0') UNION ALL 
(SELECT 'DataTableName', 'ExampleDataTable') UNION ALL 
(SELECT 'TargetTable', '#TABLE') 
--#GetAnalysis 

(SELECT * FROM #TABLE) 
(SELECT 'MaximumCount', '0') 
--#ShowReport