# How to write multiple queries in sql script to use with Process SQL file API and retrieve the values from locker?

In order to create a valid SQL script,below basic configuration settings is required to create a connection.

<div class="codeSnippet" id="bkmrk-copy----dbvendor%3D%28my">[Copy](javascript:void(0);)<div class="codeSnippetBody" data-mc-continue="False" data-mc-line-number-start="1" data-mc-use-line-numbers="False">```
-- dbvendor=(MYSQL,ORACLE,MSSQL any of these one)<br></br>-- username=(User that is owner of the database objects)<br></br>-- password=(Related password)<br></br>-- host=(dns name for database host)<br></br>-- schema=(database or schema)<br></br>-- port=(Port for related database vendor or custom port)
```

 </div> </div>Use --step=Step1 with step numbers to distinguish queries and -- storeInLocker= after each query statement to store the query results in locker.

DefinitionID is parameterized here with parameter name “defintionId”, this value will be passed from ds script.

<div class="codeSnippet" id="bkmrk-copy----dbvendor%3Dmys">[Copy](javascript:void(0);)<div class="codeSnippetBody" data-mc-continue="False" data-mc-line-number-start="1" data-mc-use-line-numbers="False">```
-- dbvendor=MYSQL<br></br>-- username=aiq<br></br>-- password=pwd<br></br>-- host=localhost<br></br>-- schema=aiq<br></br>-- port=3306<br></br>-- connect<br></br>--step=Step1<br></br>SELECT * from Definition where DefinitionID = :definitionId <br></br>-- storeInLocker=<br></br>--step=Step2<br></br>SELECT * from summaryelement where Anchor ="8"<br></br>-- storeInLocker=<br></br><br></br>-- step=BeforeDisc<br></br>-- step=Disconnect<br></br>-- disconnect
```

 </div> </div>To retrieve the value stored in locker , use Retrieve form Locker API and input the column name in value field.

In the below example, “DefinitionValue” and “DefinitionID” are the columns of Definition table and returns the value based on the parameter specified in above code. “SummaryElementID” returns the value as a result of second select statement in the code.

 ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/oG4AB95l762yyFio-fb220571ae40.png)

Some of the example queries :

SELECT \* from Definition where DefinitionID = :definitionId and DefinitionValue = "Iteration"

SELECT \* from Definition where DefinitionID = :definitionId or DefinitionValue = "Iteration"

execquery is used for microsoft sql server stored procedures that do return data

<div id="bkmrk-last-updated%3A-june-0">---

Last updated: <span class="mc-variable General.NewDateTimeVariable variable">June 01, 2023</span>

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>

</div>