Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / October 2005

Tip: Looking for answers? Try searching our database.

Query with changing table names

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Roberts - 27 Oct 2005 20:30 GMT
I have a web tracking program that writes it's data to a MSDE database.
Unfortunately it writes each day's data to a different table. It names them
connection_events_2005_10_20 then connection_events_2005_10_21 etc... I need
to create a report by the week from all of these tables.  Is there away to
query all of the tables that start with "connection_events_ " at the same
time? Is there a different way to deal with this?

Thanks in advance for your suggestions.

Steve
Sylvain Lafontaine - 27 Oct 2005 21:15 GMT
Sorry to be rude but this a bad design: you should use a single table and
add a field for the date.  This is how relational datas are designed to
work.

If you really want to, you can write a SP that will query for the names of
all of your tables by using either the system tables or the
INFORMATION_SCHEMA views (see m.p.sqlserver.programming or Google for more
details on this), append the names of these tables into query string with
multiples UNION and SELECT and execute this string as your resultset (or
append the data from all relevant tables into a temporary table and select
this last table as the result for the report); however, if you are able to
achieve this, then you should be able to redesign your tables in the first
place.

If you try to keep coding your schema this way - using a different table for
each set of dates - then the number of problems (and headaches) that you
will encounter will keep growing at an exponential rate.

Signature

Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF

>I have a web tracking program that writes it's data to a MSDE database.
>Unfortunately it writes each day's data to a different table. It names them
[quoted text clipped - 6 lines]
>
> Steve
Steve Roberts - 27 Oct 2005 22:07 GMT
Sylvain,

I totally agree with you! Unfortunately this database is created by our
firewall software so I have no control over it. I was shocked to see how
they set this up. I really don't understand what their reasoning was.

Thanks for the direction. I'll do some looking looking into the system
tables and INFORMATION_SCHEMA to see if I can figure it out from there. I
was just not sure where to start looking.

Steve

> Sorry to be rude but this a bad design: you should use a single table and
> add a field for the date.  This is how relational datas are designed to
[quoted text clipped - 24 lines]
>>
>> Steve
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.