x
login about faq Site discussion (meta-askssc)

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 '12 at 02:26 PM in Default

denkyira gravatar image

denkyira
20 1 1 4

(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 '12 at 02:54 PM

Tim gravatar image

Tim
31.5k 20 31 116

Thanks Tim. your query did it.

Mar 18 '12 at 10:23 PM denkyira

Glad I could help. Do you mind selecting my response as your answer?

Mar 19 '12 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.

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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x12

asked: Mar 17 '12 at 02:26 PM

Seen: 265 times

Last Updated: Mar 19 '12 at 01:34 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.