Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Records which have been added or updated recently

Author  Topic 

eddy556
Starting Member

36 Posts

Posted - 2009-01-05 : 04:30:24
Is it possible to query for all records which have been, say, added or updated within the past week?

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-01-05 : 04:35:51
u want to get the records which are updated r inserted with in lastweek

if u have any date column in urtable u can get the details by where condtion on that datecolumn
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-05 : 04:58:36
best way to deal with this is to use audit trail columns like lastupdated,datecreated...
If you cant change structure of main table, consider creating an audit table to track changes in main table
Go to Top of Page

eddy556
Starting Member

36 Posts

Posted - 2009-01-05 : 07:05:19
Many thanks, this is what I was thinking.

However is there NO other way of doing this? i.e. asking the database itself to return any records edited within the last week, or is such data not stored?
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-01-05 : 07:12:51
I think no other way
only if the datecolumn is present in the table then only we can get the records of last week
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2009-01-05 : 07:27:05
or upgrade to 2008 which has 'change data capture' built in

Em
Go to Top of Page
   

- Advertisement -