# New query for SQL Loader

**URL:** <https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476>\
**Category:** SHF Discussion and Questions\
**Tags:** sailpoint-identity-security\
**Created:** [September 23, 2024, 10:21am UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476 "2024-09-23T10:21:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![KottiSravya](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@KottiSravya](https://developer.sailpoint.com/discuss/u/KottiSravya)\
**Post date:** [September 23, 2024, 10:21am UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/1 "2024-09-23T10:21:25Z")

</div>

I have established a connection using SQL Loader to one of the authoritative sources in SailPoint ISC. I’m trying to write a query where I need to import employees whose onboard date is current date+14days and offboarded date is current date less than 30 days. What is the query and where to write the query.

---

<div class="post-metadata">

**Author:** ![gourab](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/gourab/32/18650_2.png) [@gourab](https://developer.sailpoint.com/discuss/u/gourab)\
**Post date:** [September 23, 2024, 10:32am UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/2 "2024-09-23T10:32:26Z")

</div>

Hi @KottiSravya ,  
You can configure the SQL queries on Account query settings page to retrieve account data . Please follow here: [Account Query Settings](https://documentation.sailpoint.com/connectors/sql_loader/help/integrating_sql_loader/account_query_settings.html)

---

<div class="post-metadata">

**Author:** ![Anshu\_Kunal](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/anshu_kunal/32/14680_2.png) [@Anshu\_Kunal](https://developer.sailpoint.com/discuss/u/Anshu_Kunal)\
**Post date:** [September 23, 2024, 11:30am UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/3 "2024-09-23T11:30:07Z")

</div>

@KottiSravya  
You will need to convert the string date (since you are reading from csv) to a date format and compare it with the current date plus 30 days.  
Here’s an example assuming the table is named ‘employees’ and the joining date is stored in a column called ‘joining\_date’ as a string (in ‘YYYY-MM-DD’ format):

> SELECT \*  
> FROM employees  
> WHERE CAST(joining\_date AS DATE) = CAST(GETDATE() AS DATE) + 30;

Thanks

---

<div class="post-metadata">

**Author:** ![KottiSravya](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@KottiSravya](https://developer.sailpoint.com/discuss/u/KottiSravya)\
**Post date:** [September 24, 2024, 9:50am UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/4 "2024-09-24T09:50:35Z")

</div>

Hi @Anshu_Kunal The above query is not working and I’m not able to filter out the accounts which are onboard date is current date+14days and offboard date is current date\< 30 days. Please help me with any other query.

---

<div class="post-metadata">

**Author:** ![KottiSravya](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@KottiSravya](https://developer.sailpoint.com/discuss/u/KottiSravya)\
**Post date:** [September 24, 2024, 10:07am UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/5 "2024-09-24T10:07:09Z")

</div>

HI @Anshu_Kunal it is throwing the below error.

 ![Screenshot 2024-09-24 153623](https://global.discourse-cdn.com/sailpoint/original/3X/7/2/72a5156db08aeaa304f84f5ae0b7c946134fc68e.png)

---

<div class="post-metadata">

**Author:** ![gourab](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/gourab/32/18650_2.png) [@gourab](https://developer.sailpoint.com/discuss/u/gourab)\
**Post date:** [September 24, 2024, 10:14am UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/6 "2024-09-24T10:14:57Z")

</div>

Could you please try this once

```SELECT
FROM employees
WHERE CAST(joining_date AS DATE) = CAST(CURRENT_DATE AS DATE) + 30;

```

or

```auto
SELECT *
FROM employees
WHERE CAST(joining_date AS DATE) = CAST(SYSDATE() AS DATE) + 30;

```

---

<div class="post-metadata">

**Author:** ![KottiSravya](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@KottiSravya](https://developer.sailpoint.com/discuss/u/KottiSravya)\
**Post date:** [September 24, 2024, 12:36pm UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/7 "2024-09-24T12:36:35Z")

</div>

Hi Gourab,  
Query is aggregating successfully while using these queries but none of the accounts are not popping up in SailPoint.

---

<div class="post-metadata">

**Author:** ![gourab](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/gourab/32/18650_2.png) [@gourab](https://developer.sailpoint.com/discuss/u/gourab)\
**Post date:** [September 24, 2024, 12:39pm UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/8 "2024-09-24T12:39:48Z")

</div>

could you please check once the table(csv) and attribute names?Also make sure you have valid data in environment that satisfies the logic

---

<div class="post-metadata">

**Author:** ![Mccarney](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/mccarney/32/14953_2.png) [@Mccarney](https://developer.sailpoint.com/discuss/u/Mccarney)\
**Post date:** [September 24, 2024, 1:35pm UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/9 "2024-09-24T13:35:28Z")

</div>

If the accounts are missing a Unique ID, Email or Last Name they wont appear as Identities. Have you checked the Identity Exception Report on the Identity Profile?

---

<div class="post-metadata">

**Author:** ![KottiSravya](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@KottiSravya](https://developer.sailpoint.com/discuss/u/KottiSravya)\
**Post date:** [September 24, 2024, 4:57pm UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/10 "2024-09-24T16:57:02Z")

</div>

Hi @gourab How to concatenate two quires in SQL Loader. Tried using UNION and AND it didn’t worked for me

CAST([End Date] AS DATE) \>= CAST(SYSDATE() AS DATE) - 30 CAST([Start Date] AS date)\<= CAST(SYSDATE() AS date) + 14;

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [November 23, 2024, 4:57pm UTC](https://developer.sailpoint.com/discuss/t/new-query-for-sql-loader/82476/11 "2024-11-23T16:57:32Z")

</div>

Closed on November 23, 2024, 4:57pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
