Skip to content
Advertisement

Tag: dynamic-sql

How to rotate a two-column table?

This might be a novice question – I’m still learning. I’m on PostgreSQL 9.6 with the following query: My query returns the following dynamic rows: locales count en 10 fr 7 de 3 n additional locales (~300)… n-count I’m trying to rotate it so that locale values end up as columns with a single row, like this: en fr de

Like in dynamic function

The code below works well. I however have issues trying to turn it into a like statement that I need some assistance with So far, I have tried the code below but with not much success I have also tried; Answer If your stored procedure parameter is @deliverer and your dynamic SQL parameter is @pt, I believe your sp_executesql execution

Copy all values from source table to destination table dynamically in SQL Server. If there is some value in destination table then delete and insert

I have created 2 tables and populated the values in my source table. Now, I want to populate these values into the destination table dynamically and also check if there is any value in the destination table then delete all those values and insert them from the source. This is my approach which is not executing: Answer In your select

ora-00900 invalid sql statement execute immediate

I am trying to solve a task with a dynamic SQL, but facing an issue ora-00900 invalid sql statement. However, it works in the anonymous block treating the statement to be executed as a string. So where is the issue in the first case? It looks like with escape quotes, but can’t catch this. Answer As the error says, execute

Dynamic SQL stored procedure and datetime

I have a simple query that I want to convert to dynamic SQL. I have 2 input parameters: a table and a datetime. And the output is the rowcount for the table and this specific datetime. I tried different solutions. I tried the query with execute sp_executesql, I tied to add the the ”’ before and after the @P_LOAD_DATE. I

Advertisement