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
 General SQL Server Forums
 New to SQL Server Programming
 trace table updation

Author  Topic 

Prabhat
Starting Member

7 Posts

Posted - 2008-07-23 : 07:24:01
Hi all
i want to know , how we can check the updated field or inserted field in a table ,
or Can we check which rows inserted today into table by date
I m using sql 2000 and i want to select rows which is inserted today what there r any property to check it by date
Plz help its urgent for me
Thx

P Tyagi

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-23 : 07:30:23
by updated/inserted field due you mean values from inserted table? if yes, this can be accesed either inside triggers or using the OUTPUT clause available in 2005. If not,please explain what you're looking at.
the rows inserted today can be checked easily if you've an audit column like datemodified. just use

select * from yourtable where datemodified=dateadd(d,datediff(d,0,getdate()),0)
Go to Top of Page

Prabhat
Starting Member

7 Posts

Posted - 2008-07-23 : 07:54:59
quote:
Originally posted by Prabhat

Hi all
i want to know , how we can check the updated field or inserted field in a table ,
or Can we check which rows inserted today into table by date
I m using sql 2000 and i want to select rows which is inserted today what there r any property to check it by date
Plz help its urgent for me
Thx

P Tyagi



Please reply

P Tyagi
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-07-23 : 07:57:35
yes if you have a datetime column that holds this information .
otherwise no.

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-07-23 : 07:58:21
?? you got a reply? what didn't you like about it?

Em
Go to Top of Page

Prabhat
Starting Member

7 Posts

Posted - 2008-07-23 : 08:03:04
ok

P Tyagi
Go to Top of Page

aoriju
Posting Yak Master

156 Posts

Posted - 2008-07-23 : 08:14:17
select * from yourtable where datemodified = getdate()

quote:
Originally posted by visakh16

by updated/inserted field due you mean values from inserted table? if yes, this can be accesed either inside triggers or using the OUTPUT clause available in 2005. If not,please explain what you're looking at.
the rows inserted today can be checked easily if you've an audit column like datemodified. just use

select * from yourtable where datemodified=dateadd(d,datediff(d,0,getdate()),0)

Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-07-23 : 08:16:29
you don't really think that would work do you?

quote:
Originally posted by aoriju

select * from yourtable where datemodified = getdate()

quote:
Originally posted by visakh16

by updated/inserted field due you mean values from inserted table? if yes, this can be accesed either inside triggers or using the OUTPUT clause available in 2005. If not,please explain what you're looking at.
the rows inserted today can be checked easily if you've an audit column like datemodified. just use

select * from yourtable where datemodified=dateadd(d,datediff(d,0,getdate()),0)





Em
Go to Top of Page
   

- Advertisement -