x

Get changes from Audit table

I have inherited an application which uses a trigger on a table to create an audit table. So there is table A which has a trigger created on it to create table A_log. What I need is an sql statement or a store procedure to show all the changes that occurred for the last 30 days. Any help will be appreciated
more ▼

asked Mar 17, 2012 at 02:26 PM in Default

denkyira gravatar image

denkyira
30 2 4 5

(comments are locked)
10|1200 characters needed characters left

1 answer: sort newest

Can you post the table design? Surely there is a timestamp column in the tablea_log table. A simple where clause filtering on the date range should accomplish what you need.

 SELECT COlUMN1, COLUMN2, COLUMN3  
 FROM TABLEA_LOG  
 WHERE DATE_COLUMN BETWEEN DATE1 AND DATE2  
or you could use WHERE DATE_COLUMN > '2012-02-17'
more ▼

answered Mar 17, 2012 at 02:54 PM

Tim gravatar image

Tim
36.4k 35 41 139

Thanks Tim. your query did it.
Mar 18, 2012 at 10:23 PM denkyira
Glad I could help. Do you mind selecting my response as your answer?
Mar 19, 2012 at 01:34 AM Tim
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x18

asked: Mar 17, 2012 at 02:26 PM

Seen: 484 times

Last Updated: Mar 19, 2012 at 01:34 AM