dynamic-sql Questions
1
Solved
Is it possible to do the following in Postgres:
SELECT column_name FROM information_schema WHERE table_name = 'somereport' AND data_type = 'integer';
SELECT SUM(coulmn_name[0]),SUM(coulmn_name[1]...
Incarnation asked 19/8, 2012 at 16:22
1
Solved
In MySQL, we can generate the prepared statement using PreparedStatement.
I want to achieve the same functionality in SQL script. How to create the prepared statement and how to execute it? ...
Margheritamargi asked 16/8, 2012 at 9:51
3
Solved
I have a table address_all and it is inherited by several address tables. address_history inherits from parent table history_all and keeps current address information. I am creating new table which...
Gird asked 7/8, 2012 at 16:24
1
Solved
Example:
Table=["category1","category2","category3"]
for varTable in Table:
cr.execute('update varTable SET id=%s,WHERE id=%s)
........
....
How to do this loop?
Uroscopy asked 2/8, 2012 at 1:26
1
Solved
This may be an easy answer but I've been staring at it for too long...
I have the following query that takes a stored procedure input parameter as a variable name and counts the records in that ta...
Bayne asked 19/6, 2012 at 20:0
2
Solved
Consider a read-only service that needs to do real time searching of a backing database. The service needs to be able to generate fairly complex select queries to generate summaries, reports,...
Vocalise asked 3/5, 2012 at 14:50
2
Solved
First of all, yes I've read documentation for DO statement :)
http://www.postgresql.org/docs/9.1/static/sql-do.html
So my question:
I need to execute some dynamic block of code that contains UPDA...
Liquid asked 16/4, 2012 at 13:27
1
Solved
My PostgreSQL database contains a table to store instances of a registered entity. This table is populated via spreadsheet upload. A web interface allows an operator to modify the information prese...
Tim asked 11/4, 2012 at 15:56
5
Solved
Something like this.
http://code.google.com/p/squiggle-sql/wiki/Tutorial.
This is required for cases where It is required to build complex sql from the user input from UI. Currently in the ...
Downspout asked 19/4, 2010 at 22:18
1
I have a function in Postgres:
CREATE OR REPLACE FUNCTION upsert(sql_insert text, sql_update text)
RETURNS integer AS
$BODY$
BEGIN
EXECUTE sql_insert;
RETURN 1;
EXCEPTION WHEN unique_violation ...
Grosgrain asked 14/2, 2012 at 5:8
3
Solved
I have 5 tables. One primary and 4 additional (they have different columns).
objects
obj_mobiles
obj_tablets
obj_computers
Here is the structure of my main table (objects).
ID | type | name ...
Mazda asked 13/1, 2012 at 14:7
1
Solved
Assume that I have thousands of rows to update.
And I plan to do the update iteratively; by only updating 1000 rows per iteration.
And I want to iterate until there are no rows left to update.
...
Doud asked 29/12, 2011 at 9:28
1
Solved
Can functions be stored as anonymous functions directly in column as its value?
Let's say I want this function be stored in column.
Example (pseudocode):
Table my_table: pk (int), my_function (fu...
Typical asked 9/11, 2011 at 16:44
1
I need to select rows from two and more tables ("A", "B"). They have differences columns and I don't use inheritance for it.
So. For example:
SELECT * FROM "A" UNION SELECT * FROM "B"
ERROR: ...
Doenitz asked 8/11, 2011 at 15:0
2
I'm using Sql Server 2008 and have a proc that uses sp_executesql inside. I keep getting the following error when executing the proc through ASP.NET:
The SELECT permission was denied on the object...
Forthwith asked 3/2, 2010 at 23:55
3
Solved
I need to know the column type in PostgreSQL (i.e. varchar(20)). I know that I could probably find this using \d something in psql, but I need it to be done with a select query.
Is this possible in...
Winson asked 2/12, 2010 at 14:51
3
Solved
After the excellent answer by Alexandre GUIDET, I attempted to run the following query:
create table egg (id (SELECT
pg_catalog.format_type(a.atttypid, a.atttypmod) as Datatype
FROM
pg_cata...
Institutionalize asked 2/12, 2010 at 15:13
3
Solved
If I have a SQL script stored in a variable like this:
DECLARE @SQL VARCHAR(MAX) = 'SELECT * FROM Employees WHERE Age > 80'
How can I tell if @SQL would return any rows if I were to run it?
...
Alboran asked 10/10, 2011 at 21:20
2
Trying the following code. But getting 'The argument 1 of the xml data type method "modify" must be a string literal' error. searched alot but cant find any solution for this problem
SET @Path = '...
Krongold asked 13/4, 2010 at 8:24
2
Solved
In Oracle, when writing dynamic SQL one does something like this:
create or replace procedure myProc(n in number)
as
begin
execute immediate
'update myTable set myColumn = :n'
using n;
commit;...
Hanghangar asked 1/8, 2011 at 12:47
1
Is it possible to create a trigger in MySQL using dynamically generated SQL from within a stored procedure? I am executing other dynamically constructed queries in my procedure by preparing a state...
Candycecandystriped asked 12/5, 2011 at 16:37
2
Solved
I have created a procedure in dynamic SQL which has a select statement and the code looks like:
ALTER PROCEDURE cagroup (
@DataID INT ,
@days INT ,
@GName VARCHAR(50) ,
@T_ID INT ,
@Act BIT ,...
Adlai asked 17/5, 2011 at 17:3
5
Solved
I need to use dynamic SQL execution on Oracle where I do not know the exact number of bind variables used in the SQL before runtime.
Is there a way to use a variable number of bind variables in th...
Catania asked 17/6, 2009 at 15:45
1
Solved
I got many different SQL tables with the same design - all have identity and two string fields with the same names. I do not want to write a set of functions to get values from these tables, i want...
Selwin asked 18/5, 2011 at 7:28
2
Solved
I've the following MS SQL stored procedure. I need to sort the results without using dynamic SQL and sp_executesql method
@Order by can have the possible values ProductName ASC, ProductName DESC, ...
Song asked 17/5, 2011 at 5:29
© 2022 - 2024 — McMap. All rights reserved.