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 Date arrivals

Author  Topic 

hamid.y
Starting Member

22 Posts

Posted - 2010-03-01 : 08:54:03
i want to check a date and if 2 hours remaning to that date just prompt user.
can you help me.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-01 : 08:56:15
quote:
Originally posted by hamid.y

i want to check a date and if 2 hours remaning to that date just prompt user.
can you help me.


Post some sample data with expected result

Madhivanan

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

hamid.y
Starting Member

22 Posts

Posted - 2010-03-01 : 09:00:59
for example this is the date :
2010-03-07 17:18:41.473

i want if the time is
2010-03-07 15:18:41.473

sql prompt me an alarm.

how can i check continuously with NOW time?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-01 : 09:08:17
where datecol>=dateadd(hour,2,getdate())

Madhivanan

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

hamid.y
Starting Member

22 Posts

Posted - 2010-03-01 : 09:11:12
you are right.
but it works when you wanna run it yourself explicitly.
but i wanna check it automatically .
i mean whenever the time diff of current time and my datecol have been 2 hours sql automatically prompt me and no need to execute it.
thanks again
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-01 : 09:13:34
quote:
Originally posted by hamid.y

you are right.
but it works when you wanna run it yourself explicitly.
but i wanna check it automatically .
i mean whenever the time diff of current time and my datecol have been 2 hours sql automatically prompt me and no need to execute it.
thanks again


SQL Server can't prompt you. It is the job of a front end
What you can do is set up a job that runs periodically

Madhivanan

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

hamid.y
Starting Member

22 Posts

Posted - 2010-03-01 : 09:14:40
thanks dear
Go to Top of Page
   

- Advertisement -