Getting Started #
The Load SQL Statement as Report feature allows you to take a provided SQL Statement and load it as a TAD Report for data retrieval, analysis, or reporting purposes.
This is typically used when a custom SQL query has been provided to you for use in TAD.
A sample SQL Statement is provided at the bottom of this article, using the TAD Sandbox table, which all users have access to by default.
Loading a Report #
Click the Add Report button on the left side of the ribbon.

Click the Query button on the left side of the window.

Paste the SQL Statement into the SQL Statement field.
Click the Load Report button to process the query.

You will see a confirmation message stating that the report has been successfully loaded into TAD.

The SQL Statement field will be updated to display only the SQL query, and the various sections on the left side (such as Select, From, Join, Where, etc.) will be automatically populated based on the statement structure.

Change the Tab Name if needed.
Click Download Changes to apply the updates and retrieve the data.

If you’re using the sample SQL Statement or one that includes parameters, the TAD Parameters form will appear.
Click the Download button to proceed with retrieving the data.

You will see the records in the Report, along with the blue Download button that guides your workflow for retrieving and processing data.

HQ Company Join #
If Company data security is active in Vista, the HQCO table must be included in every SQL Statement to ensure proper data security.
If the SQL Statement you load does not already contain the HQCO table, it will be automatically added to ensure compliance with security rules.
The statement below does not contain the HQCO table, and as a result, it will be added automatically.

When you click the Load Report button, you will receive the following message indicating that the HQCO table has been automatically added to the SQL Statement for security purposes.

The statement below now contains the HQCO table, ensuring that company data security is properly applied.

Sample SQL Statement #
You can use the code below to load the TAD Sandbox as a Report.
/*Report:0;LT:TABLE;CF:4;C1:0,C2:0,C3:@,C4:#,###,###,##0.00!@#$%^&*(;CST:4;TS:TableStyleMedium2;HS:TADHeaderStyle;*/
/*Package:Download*/
/*Parameters:(Companies):udTADSandbox.Co*/
DECLARE @(Companies) varchar(100); SET @(Companies)=''
SELECT udTADSandbox.Co, udTADSandbox.Seq, udTADSandbox.State, udTADSandbox.BudgetAmt
FROM udTADSandbox
INNER JOIN HQCO HQCompany ON udTADSandbox.Co=HQCompany.HQCo
WHERE (udTADSandbox.Co IN (@(Companies)) OR LEN(@(Companies))=0)