•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 402,048 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,529 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 287 | Replies: 2
![]() |
•
•
Join Date: Jul 2008
Posts: 8
Reputation:
Rep Power: 0
Solved Threads: 1
Why is this script not working..
This is suppose to take 1 day of a users remaming days every 24 hours,, But its not working..
Please help.
USE [KN_online] GO SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[UPDATE_PREMIUM_SERVICE_USER_EXEC] AS DECLARE @d24 datetime SET @d24 = DateAdd(hh,-24, GETDATE()) UPDATE PREMIUM_SERVICE SET nDays = nDays - 1 where Date > @d24
This is suppose to take 1 day of a users remaming days every 24 hours,, But its not working..
Please help.
•
•
Join Date: Jul 2008
Posts: 8
Reputation:
Rep Power: 0
Solved Threads: 1
Ok got the first part done.
Just another little problem..
Just another little problem..
USE [KN_online]
GO
/****** Object: StoredProcedure [dbo].[UPDATE_PREMIUM_SERVICE_USER_EXEC] Script Date: 07/20/2008 17:28:50 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[UPDATE_PREMIUM_SERVICE_USER_EXEC]
AS
DECLARE @d24 smalldatetime
--- Below \/ = Check if date has been more than 24 hours,
--- If yes then deduct 1 day for Premium
--- WORKS 100%
SET @d24 = DateAdd(hh,-24, GETDATE())
UPDATE PREMIUM_SERVICE_EXEC SET nDays = nDays - 1 where @d24 > Date
--- Below \/ = Check if Date has been more than 24 Hours, If yes start Begin
--- DONT WORK ATALL
SET @d24 = DateAdd(hh,-24, GETDATE())
if @d24 = getdate()
BEGIN
UPDATE PREMIUM_SERVICE_EXEC SET Date = getdate()
END•
•
Join Date: Jul 2008
Posts: 8
Reputation:
Rep Power: 0
Solved Threads: 1
I got this, but its updating the info every 15 mins, I need it to be every 1440 mins or 24 hours.
Can anyone help me?
Can anyone help me?
DECLARE @d24 smalldatetime SET @d24 = CONVERT(VARCHAR(15) , GETDATE(),102) SET @d24 = DATEADD(HH,DATEPART(HH,dateadd(MI, 10, GETDATE())),@d24) UPDATE PREMIUM_SERVICE SET nDays = nDays - 1 where @d24 > Date UPDATE PREMIUM_SERVICE SET Date = getdate()where @d24 > Date
![]() |
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- how do I run a "disconnected" stored procedure (MS SQL)
- Stored procedure call with ADO (C)
- the procedure entry (Viruses, Spyware and other Nasties)
- The procedure entry point DdEntry1 could not be located in the dynamic link library G (Windows NT / 2000 / XP / 2003)
- The procedure entry point DdEntry1 could not be located in the dynamic link library G (Windows NT / 2000 / XP / 2003)
- Error when making an event procedure in Visual Basic (C)
- Retrieving a field from a SQL procedure (ASP)
- Dangerous Bug in HijackThis 1.97.7 Restoral Procedure (Viruses, Spyware and other Nasties)
Other Threads in the MS SQL Forum
- Previous Thread: Select Previous Row Values
- Next Thread: Selection between ranges in sql server 2005


Linear Mode