Showing posts with label transaction. Show all posts
Showing posts with label transaction. Show all posts

Friday, February 24, 2012

Date Difference

A table has 2 columns (Date and Trans). Date has the date of the
transaction, Trans contains whether the transacion was an invoice or a
payment.
I need to determine how long customers are taking to pay their bills.
How can I find the difference in the invoice date and the payment date
if both dates are part of the same field?Assuming there is some key value which shows that the 2 rows are connected
( and I am calling the field KEY)..
Select datediff(dd,i.[date],p.[date]) from thetable i inner join thetable p
on i.key = p.key
WHere whatever selection criteria you wish to use...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Bunckles" <chris.bunch@.gmail.com> wrote in message
news:1117648478.631189.171300@.z14g2000cwz.googlegroups.com...
>A table has 2 columns (Date and Trans). Date has the date of the
> transaction, Trans contains whether the transacion was an invoice or a
> payment.
> I need to determine how long customers are taking to pay their bills.
> How can I find the difference in the invoice date and the payment date
> if both dates are part of the same field?
>

Tuesday, February 14, 2012

Date and time of last transaction in a given database

Hi,
Is there a query I can run to get the date and time of the last transaction
to a SQL database?
Kind of like the Last Modified date of an Acess Database.
Thanks,
Ronhi,
If you don't have triggers fitted out in your tables is very tricky to aware
of that. Do you have any chance to open QA and launch "dbcc
log(<name_of_log>,2)" statement?
Well, once done you'll see some interesting things.
Current location: Alicante (ES)
"RSH" wrote:

> Hi,
> Is there a query I can run to get the date and time of the last transactio
n
> to a SQL database?
> Kind of like the Last Modified date of an Acess Database.
> Thanks,
> Ron
>
>