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)
 double posts

Author  Topic 

missMac
Posting Yak Master

124 Posts

Posted - 2009-01-08 : 04:24:57
Hello,
we are trying to avoid double posts in our application. And dont want to implement it with a disable button.

So we are looking to check the last 3 seconds. Here is our code

select * from illing_Transactions
where TransactionDate < DATEADD(s,3,getdate()) and TransactionDate > DATEADD(s,3,getdate())


but nothing is returned

Jai Krishna
Constraint Violating Yak Guru

333 Posts

Posted - 2009-01-08 : 04:28:52
select * from illing_Transactions
where TransactionDate < DATEADD(s,3,getdate()) and TransactionDate > DATEADD(s,3,getdate())

ur query doesnt return anything because ur trying to retrieve on the same condition like
select * from urtable where col>1 and col<1

Jai Krishna
Go to Top of Page

missMac
Posting Yak Master

124 Posts

Posted - 2009-01-08 : 04:37:14
I want to get dates posted greater than the last 3 seconds.

Ie a double post will be given plus or minus, error of 3 seconds
Go to Top of Page

Jai Krishna
Constraint Violating Yak Guru

333 Posts

Posted - 2009-01-08 : 04:46:52
Hi try this

select * from illing_Transactions
where TransactionDate > DATEADD(s,-3,getdate())

Jai Krishna
Go to Top of Page

raky
Aged Yak Warrior

767 Posts

Posted - 2009-01-08 : 04:49:33
Hi

try this also

select * from illing_Transactions
where datediff(s,TransactionDate,getdate()) > 3
Go to Top of Page

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2009-01-08 : 04:57:41
select * from illing_transactions where transactiondate > dateadd(s,-3,getdate()) and transactiondate < getdate()
May Be This Solve your Problem,,
Thanks....
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-08 : 08:57:53
[code]select * from illing_Transactions
where ABS( datediff(s,TransactionDate,getdate()))<=3[/code]
Go to Top of Page
   

- Advertisement -