Let's see if I can make sense of this...
I have a user table, holding the names of active users:
-dbo.jsmith
-dbo.johnson
-dbo.echarles
...
I also have a history table for EACH user, and these tables are named "history" & the username:
-dbo.historyjsmith
-dbo.historyjohnson
-dbo.historyecharles
...
Each time a user accesses an account, the program creates a new row in the user's history table, listing the account number and datetime accessed. A single account may be accessed by multiple users, multiple times. So, the account number may appear several times in several history tables.
I'm looking for a way to easily search all history tables for occurences of a particular account number, so that I can see who has accessed any account I choose.
Is there a way to do this without running a query for each history table?
By the way, this is running on SQL server 2005.
Thanks for your help!
I have a user table, holding the names of active users:
-dbo.jsmith
-dbo.johnson
-dbo.echarles
...
I also have a history table for EACH user, and these tables are named "history" & the username:
-dbo.historyjsmith
-dbo.historyjohnson
-dbo.historyecharles
...
Each time a user accesses an account, the program creates a new row in the user's history table, listing the account number and datetime accessed. A single account may be accessed by multiple users, multiple times. So, the account number may appear several times in several history tables.
I'm looking for a way to easily search all history tables for occurences of a particular account number, so that I can see who has accessed any account I choose.
Is there a way to do this without running a query for each history table?
By the way, this is running on SQL server 2005.
Thanks for your help!