# How to call a external table which is inside a schema in Connect SQL

**URL:** <https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868>\
**Category:** General\
**Tags:** admin-studio, theme-cosmos, self-service, app-studio, dev-designer-studio, accessibility, 8-8-3, constellation, data-integration, data-management, case-management\
**Created:** [July 25, 2024, 8:38am UTC](https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868 "2024-07-25T08:38:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavanir6](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@Pavanir6](https://forums.pega.com/u/Pavanir6)\
**Post date:** [July 25, 2024, 8:38am UTC](https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868/1 "2024-07-25T08:38:37Z")

</div>

Hi All,

I have to call a external DB table as below. I am getting error as invalid identifier.

SELECT col1,col2 FROM  
TABLE(xxx\_dta\_base.PKG\_USR\_xxx.get\_disp\_dta(12345,TO\_DATE(‘05/20/2024’,‘MM/DD/YYYY’)))

---

<div class="post-metadata">

**Author:** ![kammv](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@kammv](https://forums.pega.com/u/kammv)\
**Post date:** [July 25, 2024, 7:27am UTC](https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868/2 "2024-07-25T07:27:15Z")

</div>

@Pavanir6 can you paste the exact error which specifies the line number where the error is occuring

---

<div class="post-metadata">

**Author:** ![RameshSangili](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/rameshsangili/32/23377_2.png) [@RameshSangili](https://forums.pega.com/u/RameshSangili)\
**Post date:** [July 25, 2024, 4:09pm UTC](https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868/3 "2024-07-25T16:09:03Z")

</div>

@Pavanir6

Did you run the exact query from SQL from your SQL server to ensure that this issue is related to the query or connect-sql?

---

<div class="post-metadata">

**Author:** ![Pavanir6](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@Pavanir6](https://forums.pega.com/u/Pavanir6)\
**Post date:** [July 26, 2024, 5:59pm UTC](https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868/4 "2024-07-26T17:59:30Z")

</div>

@RameshSangili I am using this query in Pega connect sql rule and error says invalid identifier “xxx\_dta\_base.PKG\_USR\_xxx.get\_disp\_dta”

---

<div class="post-metadata">

**Author:** ![Pavanir6](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@Pavanir6](https://forums.pega.com/u/Pavanir6)\
**Post date:** [July 26, 2024, 5:59pm UTC](https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868/5 "2024-07-26T17:59:45Z")

</div>

@kammv error says invalid identifier “xxx\_dta\_base.PKG\_USR\_xxx.get\_disp\_dta” in Pega connect sql

---

<div class="post-metadata">

**Author:** ![RameshSangili](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/rameshsangili/32/23377_2.png) [@RameshSangili](https://forums.pega.com/u/RameshSangili)\
**Post date:** [July 26, 2024, 8:49pm UTC](https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868/6 "2024-07-26T20:49:21Z")

</div>

@Pavanir6

To isolate the issue - Did you check the same query works fine if you execute in SQL server or DB instance?

Is this an issue only with connect-SQL rule?

---

<div class="post-metadata">

**Author:** ![Pavanir6](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@Pavanir6](https://forums.pega.com/u/Pavanir6)\
**Post date:** [August 20, 2024, 9:22am UTC](https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868/7 "2024-08-20T09:22:31Z")

</div>

@RameshSangili i executed this in DB directly its working, only from connect sql i have issue.

---

<div class="post-metadata">

**Author:** ![MarijeSchillern](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/marijeschillern/32/23321_2.png) [@MarijeSchillern](https://forums.pega.com/u/MarijeSchillern)\
**Post date:** [August 20, 2024, 10:42am UTC](https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868/8 "2024-08-20T10:42:33Z")

</div>

@Pavanir6 if the product is not behaving as documented and you can replicate the issue consistently feel free to log a support issue via the [MSP](https://msp.pega.com/)

Before you do, please check the below:

⚠ This is a GenAI-powered tool. All generated answers require validation against the provided references.

To call an external table inside a schema using Connect SQL in Pega, you need to ensure that the schema name is correctly specified in the Connect-SQL rule. If you are encountering an ‘invalid identifier’ error, it might be due to the schema name not being correctly referenced in the Connect-SQL rule. Here are the steps to follow:

1. **Specify the Schema Name** : Ensure that the schema name is explicitly mentioned before the table name in the Connect-SQL rule. For example, use `schema_name.table_name`.

2. **Database Table Rule** : Verify that the database table rule is correctly configured to map the class to the external table. This includes specifying the correct schema and table name.

3. **JDBC URL** : Ensure that the JDBC URL in the database rule is correctly formatted to include the schema. For example, `jdbc:postgresql://<hostname>:<port>/<databasename>?currentSchema=schema_name`.

4. **Environment Configuration** : Check if there are any environment-specific configurations that might be causing the issue. Sometimes, what works in one environment (e.g., development) might not work in another (e.g., UAT) due to differences in configuration.\n\nIf you follow these steps and still encounter issues, you might need to hard-code the schema name in the Connect-SQL rule as a temporary workaround, as mentioned in the discussion below.

[Connect-SQL Schema](https://support.pega.com/discussion/connect-sql-schema)

[Getting error while saving context dictionary, Pega Customer Decision Hub](https://support.pega.com/question/getting-error-while-saving-context-dictionary-pega-customer-decision-hub)

---

<div class="post-metadata">

**Author:** ![Pavanir6](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@Pavanir6](https://forums.pega.com/u/Pavanir6)\
**Post date:** [August 21, 2024, 8:36am UTC](https://forums.pega.com/t/how-to-call-a-external-table-which-is-inside-a-schema-in-connect-sql/7868/9 "2024-08-21T08:36:04Z")

</div>

@MarijeSchillern

Issue resolved after server restart. Thank you all for your response and support.
