sql - Query to Access Sharded Tables -
i querying vendors database has data sharded between multiple tables. tables named events_1
, events_2
, events_3
, events_4
etc.
it appears new table automatically created when table hits 10,000 records. looking write query able union results tables (without having manually add tables created) query @ 2 newest tables.
any suggestions on best way go this?
the database microsoft sql server 2008
you can dynamic sql such query sysobjects table name events_* , build select union results.
better, though perhaps more complicated, ddl trigger dynamically update union view append new table whenever table events_* created.
Comments
Post a Comment