SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 duplicate check
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sanjay5219
Posting Yak Master

231 Posts

Posted - 08/01/2014 :  00:20:06  Show Profile  Reply with Quote
Hi all,

is there any way to check if there are any duplicate transaction within 5 minutes based on trans_no.

I will have to allow duplicates based on last transaction time

please suggest

James K
Flowing Fount of Yak Knowledge

3712 Posts

Posted - 08/01/2014 :  09:22:39  Show Profile  Reply with Quote
quote:
Originally posted by sanjay5219

Hi all,

is there any way to check if there are any duplicate transaction within 5 minutes based on trans_no.

I will have to allow duplicates based on last transaction time

please suggest



Assuming you mean transactions in your business logic (as opposed to transaction in the T-SQL sense), something like this:
SELECT transaction_id 
FROM YourTable 
WHERE transaction_time > DATEADD(mi,-5,GETDATE())
GROUP BY transaction_id 
HAVING COUNT(*) > 1
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.39 seconds. Powered By: Snitz Forums 2000