Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | 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
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sanjay5219
Posting Yak Master

240 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

3873 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  
 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.05 seconds. Powered By: Snitz Forums 2000