SqlDbx Forum

SqlDbx

You are not logged in.

#1 2009-01-22 14:06:58

katom
Member

Multiple queries with parameters

Very often I need to do something like this:

select * from table1 where user = 'user1' and date = '01/22/09'
go
select * from table2 where user = 'user1' and date = '01/22/09'
go
select * from table3 where user = 'user1' and date = '01/22/09'

I need to do it for different user and date values. Every time
I have to go and change them. It would be great if somehow it was
possible to have some kind of "macro" capability.
Thanks

Offline

#2 2009-01-23 16:57:41

sqldbxhelp
Administrator

Re: Multiple queries with parameters

Actually it is possible to do right now. Take a look below

define var_user = 'user1'
define var_date = '01/22/09'

select * from table1 where user = $(var_user) and date = $(var_date)
go
select * from table2 where user = $(var_user) and date = $(var_date)
go
select * from table3 where user = $(var_user) and date = $(var_date)

Offline

#3 2009-12-16 05:52:45

Monk
Member

Re: Multiple queries with parameters

I tested this feature for Oracle and see that it is not working properly. It is working for Sybase without problem..

Offline

#4 2009-12-16 12:18:01

sqldbxhelp
Administrator

Re: Multiple queries with parameters

In case of Oracle you have to reference variable like this &var_user.
The reason is to be compatible with SQL *Plus

Offline

#5 2011-05-20 15:10:43

Akorde
Member

Re: Multiple queries with parameters

Right, I had done this part alright.
One difficulty is that the "grid" applies to the results of all the queries. So each column gets the width of the widest column of ANY of the queries. So a column with a sindle digit number as a value can take half the screen width, if the corresponding column number in an unrelated query was a string(100).
Is it possible to "break" the grid horizontally into pieces so each query results are efficient to read ?

The 'break' of the grid could be a cmd option e.g : cmd results = new [grid | tab]
by placing these cmd options in between the sql queries, one could structure the results as desired.

Last edited by Akorde (2011-05-20 15:33:59)

Offline

#6 2011-05-20 22:19:12

sqldbxhelp
Administrator

Re: Multiple queries with parameters

You can put results in multiple grids by holding SHIFT key while executing query.

Offline

Board footer

Powered by FluxBB