Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting dates

Status
Not open for further replies.

jorg32

Programmer
Jul 10, 2003
57
BE
Hi,

I want to check in a SQL when a client hasn't payed his bills after more then 30 day's.

e.g. He has to pay on 2005/02/25 and if he hasn't payed after 30 day's (2005/03/27), he has to pay something extra.

What do I have to do so SQL count on this date every time 30 day's?

Thanks for helping me.

J.
 
Code:
declare @TimeSincePaid int,
	@Overdue varchar(10)

select @TimeSincePaid = (select datediff(day, 'Mar 10 2005', getdate()))

if @TimeSincePaid > 30
	begin
	select @Overdue = 'YES'
	end
else
	begin
	select @Overdue = 'NO'
	end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top