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)
 sending database mail

Author  Topic 

tm555
Starting Member

5 Posts

Posted - 2008-02-14 : 05:40:27
Hi,

I have the table like

Id Pickuptime
1 2008-02-14 13:07:06.317

If the record is inserted to the above table that would look at a pickuptime field in a table and if pickuptime is 2008-02-14 13:07:06.317 after 6 hour from the pickuptime then I would send a email to briteindia_kumar@hotmail.com

How i would do this would any one help to me.

Thanks
kumar

dewacorp.alliances

452 Posts

Posted - 2008-02-14 : 06:07:51
Something like this ... change the day to hour. Check out BOL.

CREATE TABLE #temp(
DateSTAMP smalldatetime)

INSERT #temp(DateSTAMP) VALUES ('2008-02-11')
INSERT #temp(DateSTAMP) VALUES ('2008-02-12')
INSERT #temp(DateSTAMP) VALUES ('2008-02-13')
INSERT #temp(DateSTAMP) VALUES ('2008-02-14')

--select * from #temp

select * from #temp
where GETDATE() >= DATEADD(day, 2, DateSTAMP)

DROP TABLE #temp
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-02-14 : 06:16:41
Don't cross post same question.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=97345

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -