0

I'm brand new to SQL Server and trying to write a stored procedure that updates a recordset with the current date/time at the time the stored procedure is called. My code keeps reporting an error near the =. The parameter @SentFax is the PK of the record needing to be updated, any ideas why this doesn't work?

CREATE PROCEDURE FaxMailerSent 
-- Add the parameters for the stored procedure here
@SentFax int = 0, 
  = 
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
UPDATE FaxMailer 
    SET Done = GetDate()
        WHERE [Fax_ID] = @SentFax; 
END
GO
2
  • Take out the comma after the @SentFax int = 0 and the ` = ` on the next line (before AS). Commented Jun 9, 2013 at 19:07
  • @ChrisShaffer your the best, thanks! put it in an answer so I can give you the credit for it Commented Jun 9, 2013 at 19:09

2 Answers 2

1

Remove the ,after @SentFax int = 0 and the = between @SentFax int = 0 and AS.

The following should work as expected:

CREATE PROCEDURE FaxMailerSent 
    @SentFax int = 0
AS
BEGIN
SET NOCOUNT ON;

UPDATE FaxMailer 
    SET Done = GetDate()
        WHERE [Fax_ID] = @SentFax; 
END
GO
Sign up to request clarification or add additional context in comments.

Comments

0

Try below

CREATE PROCEDURE FaxMailerSent 
-- Add the parameters for the stored procedure here
@SentFax int = 0
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
UPDATE FaxMailer 
    SET Done = GetDate()
        WHERE [Fax_ID] = @SentFax; 
END
GO

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.