blossompark
asked on
SELECT INTO Temp table in DB2
Hi,
I'm new to db2 but in sql server you can use a SELECT INTO clause to put the results of a query into a local table which you can then in turn query..
is there an equivalent in db2?
thanks
I'm new to db2 but in sql server you can use a SELECT INTO clause to put the results of a query into a local table which you can then in turn query..
is there an equivalent in db2?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
deleteme is just the name of the temp table...
what i am trying to do is ;
1.run a query against a db2 database
2. put the results of that query into a local table
3. Run queries against that local table that will further filter the data...
what i am trying to do is ;
1.run a query against a db2 database
2. put the results of that query into a local table
3. Run queries against that local table that will further filter the data...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
by local table I mean a temp table....the source table is located on remote server ... i want to query the remote server and the result set that is returned by this query to the remote server i want to put into a temp table and then run queries against this temp table
ASKER
a temp table in RAM is what i mean, i do not have write access to the database so i want to create a temp table in ram and query against it
ASKER
i am using SQL Profiler in Eclipse to connect to the database
ASKER
this is not possible is it? i need a db application to create the temp table and store it somewhere?
ASKER
there is a "WITH" clause I think i can use
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi daveslash and momi_sabag<br /><br />The WITH function does what I need<br /><br />WITH RAW_DATA (Group,TicketID) as<br />(<br />select distinct GROUP,<br />TICKET_ID<br /> from Table<br />)<br />SELECT * FROM RAW_DATA
ASKER
thanks for your input..
the following code works fine;
select distinct GROUP,
TICKET_ID
from Table
but when i run it as
declare global temporary table deleteme as (
select distinct GROUP,
TICKET_ID
from Table
)with data;
select * from deleteme;
i get an error