473,474 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dynamic From Clause To Create View

2 New Member
Hi,

I'm after some help with a view I am trying to create, but Im not sure if I am going about it correctly

I have hundreds of log tables, can be any number created within a month. I need to identify the last 3 months worth and union them together into one view.

I can get the log table created date/time from syscat tables which helps me identify which tables I need look at but I am unsure how to incorpoate that in my select... ie

create view ??? as select ??? from (select tabname from syscat.tables where tbname = ?? and create_time between current_timestamp - 3 MONTH and current_timestamp)

Is it possible to do something like this ?

Thanks
Oct 29 '08 #1
2 4645
sushanth bobby
6 New Member
Ivester,

select ??? from (select tabname from syscat.tables where tbname = ?? and create_time between current_timestamp - 3 MONTH and current_timestamp)
I have tried something like this, result was a flop.
It might work in a higher DB2 version like DB2 V9. So far i did'nt get a chance to use V9.

Since you have hundereds of tables created & the tables can be got from DB2 catalog.

Expand|Select|Wrap|Line Numbers
  1. select 'select ??? from ',strip(tabname), 'union all'
  2. from syscat.tables 
  3. where tbname = ?? and create_time between current_timestamp - 3 MONTH and current_timestamp
This will get you all the necessary selects for creating a view. After this you need to do a little editing in top add[create view vname(???)] and in the bottom remove the extra union all

Sushanth Bobby
Oct 30 '08 #2
ivester
2 New Member
Thanks for the reply Sushanth Bobby - that is the route I have started going down. With a bit of tweaking it should get me just what i'm looking for!
Oct 30 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Robert Scheer | last post by:
Hi. I have a stored procedure on a Oracle 8.1.6 database that generates a dynamic sql statement. This stored procedure has an output parameter that needs to return a count from a view. I can...
7
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password...
1
by: Alex Satrapa | last post by:
I have a table from which I'm trying to extract certain information. For historical reasons, we archive every action on a particular thing ('thing' is identified, funnily enough, by 'id'). So the...
2
by: klh | last post by:
We use DB2 Connect v 7.2 FP7 in Windows NT hitting a OS/390 DB2 v7.1 database. We have a Websphere (java) application that issues dynamic SQL. Most of the time when we issue dynamic SQL SELECT...
5
by: MGFoster | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've converted an ACC97 .mdb file to an ACC2K2 .adp. A report that worked in ACC97 doesn't work in ACC2K2. Report setup: ACC97 ...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
3
by: sferriol | last post by:
hello is it possible with postgres 7.2 or more, to define a dynamic view. For example, i have a table with a column 'user' and i want to define a view which gives infomrations from different...
3
by: wjreichard | last post by:
OK ... I am using UPS Worldship that issues an ODBC query to my MS2K server ... Worldship can query either a table or a view and retreive shipping info for a supplied orderid. I need to create a...
0
by: webgirl | last post by:
I'm relatively new to SQL Server & looking for some guidance, if possible. I've been reading lots of different things & am a bit confused about some basics. I have an Access Project with SQL...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.