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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-01-09 : 11:27:53
|
Shane writes "I am writing a rebilling script to bill people every month for an ad they have posted on my site. I have already figured out how to pull all the ads I need scheduled for rebill. For instance if today is 1/5/2001 Then I would want to pull these records.
SELECT adMemberName, adDate, adCharge FROM userAds WHERE Day(adDate) = '5' AND adDate < '1/5/2001'
This will pull all people due for rebilling on the fifth of the month not including the current month.
The problem this presents is this,
If someone posts an ad on the 31st, then they will only be rebilled on months with 31 days. Is there a way to detect if it is the last day of the month, so if the last day is the 28th my program will know to go and bill those who posted on the 29, 30 and 31st of the months before? I am using SQL Server 7 and WinNT 4.0
Thanks For Your Advice Shane" |
|
|
|
|
|