Re: [SQL] Junk queries with variables?

2005-02-24 Thread Steve - DND
> > I don't know about pgAdmin, but in psql you can use \set: > > \set id 1 > SELECT * FROM foo WHERE id = :id; > > \set name '\'Some Name\'' > SELECT * FROM foo WHERE name = :name; > Whenever I try the above I get an error at the backslash. Do I need to create a different language for this? Right

Re: [SQL] Junk queries with variables?

2005-02-24 Thread Steve - DND
> Michael's given you one option - another to look at is PREPARE/EXECUTE > PREPARE my_query(int4) AS INSERT INTO foo VALUES ($1); > EXECUTE my_query(1); > EXECUTE my_query(7); > ... This doesn't seem to be quite what I'm looking for. PREPARE according to the docs is for a one line statement. I'm l

[SQL] Junk queries with variables?

2005-02-23 Thread Steve - DND
I really have to be missing something here and this probably a *really* noob question. I don't have a problem running little junk queries in the pgAdmin query window(SELECT blah FROM blah, INSERT INTO blah, etc...), but I can't figure out how to run queries with variables outside of a function. I j

[SQL] Pagination with Output Variables?

2005-02-22 Thread Steve - DND
I have a MSSQL Stored Procedure that returns a particular section of a resultset depending on the desired "page". This procedure also has a parameter marked as OUTPUT which indicates the total number of records in the actual resultset. Is there a way to do something similar in PG or does TotalRecor