Issue with Combination of INSERT + CTE (with clause) + Dynamic query (IDENTIFIER function)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 07:30 AM
Hi,
We are trying to insert into a table using a CTE (WITH clause query).
In the insert we are using the INDENTIFIER function as the catalog name is retrieved dynamically.
This is causing the insert to fail with an error - The table or view `cte_query` cannot be found.
Any idea how this cam be fixed?
Example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 10:20 AM
Please mark this as resolved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 10:39 AM
Hi @UdayRPai ,
Could you share solution of you find one? This way you can help community 😉
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 08:22 AM
Hi,
We used the USE CATALOG statement with EXECUTE IMMEDIATE at the beginning and removed the catalog name from individual insert statements.

