Need help with basic stored procedure

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

One of the pages on my current project contains a simple status table that
shows whether an event has occurred or not. Currently it needs to be reset
to False at the start of each business day, then is manually flagged True
when the event occurs. The flag to True must remain manual because it is
never known when the event will happen. However it would be one less thing
to worry about when opening the store if it could be reset to False each
morning automatically.

I have never worked with Stored Procedures, and currently am managing the
SQL Server database through Access. I would appreciate some assistance both
in writing the procedure and figuring out how to trigger it at a specific
time (8:00 AM).

Here is what I have so far:
CREATE PROCEDURE dbo.ResetPickupFlag

AS

UPDATE Pickup SET PickupOccurred=False

GO

EXEC dbo.ResetPickupFlag

Currently, it returns the error "incorrect syntax near GO".

Any assistance you can provide would be appreciated.



Thanks.
Paul
 
The word or constant "False" doesn't exist in T-SQL. You must use the value
0 instead.

For executing your job at a specific time, SQL-Agent can do that easily.
You could also use a scheduled DTS job. However, it's been a too long time
since the last time that I've used SQL-Agent; so I cannot tell you more.
However, asking your question to one of the SQL-Server newsgroups will
probably get you a quick answer.
 
Changed to 0 from False, works now. Thank you. Will check out SQL-Agent.

Thank you for your help.
Paul
 
Paul,
As Sylvain said....

If you save a DTS package that fires your stored procedure, you can then
easily schedule it
to run each day at whatever time you choose.

hth,
bob
 
Back
Top