Skip to main content

Questions tagged [dynamic-sql]

Constructing a query at runtime with string concatenation operations and executing the query from that string.

0 votes
1 answer
72 views

Question: Why example 1 does not work while example 2 works: SQL Table to check for non-numeric values in varchar column: CREATE TABLE #t(Mycol varchar(15)) INSERT #t VALUES ('123.86'),('4a5.67'),('45....
nam's user avatar
  • 525
4 votes
2 answers
333 views

The @SQL variable in the statement below is always truncated when I "inline" a variable. If I send the variable in and print it does not truncate to 4000, however, I can't bind the sent in ...
Ross Bush's user avatar
  • 683
0 votes
1 answer
186 views

It is my understanding that dynamic SQL is part of a batch. Yet, when I listed for sqlserver.sql_batch_completed as follows CREATE EVENT SESSION [CaptureBatch] ON SERVER ADD EVENT sqlserver....
J. Mini's user avatar
  • 1,322
0 votes
1 answer
113 views

I've got a simple parent-child tree relationship that was built recursively Parent Child A B B E B C E NULL C NULL A F F NULL this table comes from a recursive CTE: with tree(parent, child) as (...) ...
Axeltherabbit's user avatar
0 votes
1 answer
113 views

Let's say I have multiple tables with a column foobar. And I wish to make to make all these columns reference foobar.id as a FOREIGN KEY. The problem is I know there are violations in this schema from ...
Evan Carroll's user avatar
  • 65.8k
6 votes
1 answer
1k views

I'm at a loss as to why some SQL leveraging sp_executesql is working the way it is when temporary tables are involved, along with INSERT and SELECT - INTO. I'm using SQL Server. Here is the code in ...
Wipqozn's user avatar
  • 171
0 votes
2 answers
77 views

I have a plsql below that executes dynamic sql. DECLARE sql_stmt VARCHAR2(200); BEGIN sql_stmt := 'SELECT employee_name FROM employees WHERE employee_id = :1'; EXECUTE IMMEDIATE sql_stmt ...
Idonknow's user avatar
  • 101
0 votes
1 answer
1k views

I'd like to extract some basic statistics about how tables are populated in a given PostgreSQL 16 schema, such as the absolute number and percentage of null values for each column in all tables in ...
s.k's user avatar
  • 434

15 30 50 per page
1
2 3 4 5
29