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)
 check if a field is updated current month

Author  Topic 

newbietosql1221
Starting Member

25 Posts

Posted - 2010-10-05 : 09:48:52
I need to find a way to see if a field has been updated by current month? For example a field called allocated has been updated at all by current month of october if NO then print 0 if yes print what was changed

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2010-10-05 : 10:02:03
Unless you audit changes by some means or minimally maintain a [LastModified] column then you can't tell when a specific column was last changed.

Be One with the Optimizer
TG
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-10-05 : 10:02:07
You need to use a update tigger

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

newbietosql1221
Starting Member

25 Posts

Posted - 2010-10-05 : 10:33:37
thanks tg and mad, but i dont even know where to begain with a trigger... can you help

my_date Allocated
------- ----------
10/01/2010 12:33:06 100
10/01/2010 12:50:11 200
09/29/2010 13:44:02 34
08/20/2010 22:13:46 5

so as long as the current month have value change to that value
if not leave a zero under this month allocated
Go to Top of Page
   

- Advertisement -