Hi Mitch,
Without there being a timestamp or datetime column on the actual table, there's no way for you to dynamically determine the date/time a row was inserted.
You can, however query the system catalog to determine the date the table was created.
As you mention that the tables themselves are created by an application, obviously you'd be hesitant to make any changes to the existing schema; you could, however create generic triggers on each of the tables in question that would in turn insert a flag into a control table to indicate the current "active" table"
CREATE TRIGGER tr_TableHere_ins
ON TableSourceA
FOR INSERT
AS
INSERT INTO ControlTable (InsertDate, TableSource)
VALUES(GetDate(), 'TableSourceA' )
Or Similar...
Cheers,
Rob
No comments:
Post a Comment