# Verify Whether a User Exists in the Database

We can achieve this in four steps:

1. Need a SQL file to retrieve the data from the database
2. Need a service suite script to run the SQL query and store it in a variable to compare
3. Need a CSV file that contains the user or users
4. Implementation in .ds script
 
For step-1 we have to create a SQL file in the below format:

<div class="code panel pdl conf-macro output-block" id="bkmrk----dbvendor%3Dmysql---" style="border-width: 1px;"><div class="codeContent panelContent pdl">```
-- dbvendor=MYSQL
-- username=XXXX
-- password=XXXX
-- host=localhost
-- schema=XXXX
-- port=3306
-- connect
-- limit=1-10
-- tag=executedScenarios
SELECT * from DATABASENAME.TABLENAME
-- storeInLocker=
-- disconnect
```

 </div> </div>For step-2, below are the syntax for service suite script:

<div class="code panel pdl conf-macro output-block" id="bkmrk-processsqlfile%28%22%7Bds%7D" style="border-width: 1px;"><div class="codeContent panelContent pdl">```
processSQLFile("{ds}/sqlScript.sql");
var result = JSON.parse(locker.get("executedScenarios"));
log(result);
var xyz;
locker.put("xyz",result);
```

 </div> </div>For step-3, use any CSV in below format:

 ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/jijxmfPwLKO65rOa-25976791881c.PNG)

For step-4, use the below step

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

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

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

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

</div>