Link to home
Create AccountLog in
Avatar of Dale Fye
Dale FyeFlag for United States of America

asked on

error when attempting to save SQL Server stored procedure

I'm getting the following error message 

Msg 102, Level 15, State 1, Procedure dls_ProcessTracking_Update, Line 40 [Batch Start Line 9]
Incorrect syntax near '@ProcessID'.

Open in new window

when I attempt to execute the stored procedure shown below:

USE [MyDEVDB]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:      Dale Fye
-- Create date: 10/9/23
-- Description: Update an existing record in tblProcessTracking
-- =============================================
CREATE PROCEDURE [dbo].[dls_ProcessTracking_Update]
   @ProcessID int, 
   @ProcessType nvarchar(10),
   @ProcessType_PKID int,
   @ProcessClientID int,
   @ProcessClientName nvarchar(50),
   @ProcessLoanNum nvarchar(50),
   @ProcessStartDate datetime,
   @ProcessClosedDate datetime = Null,
   @ProcessSentForRecording datetime = Null,
   @ProcessFullyExecDate datetime = NULL, 
   @ProcessDocumentID nvarchar(15) = Null,
   @ProcessDocumentIDResent nvarchar(15) = NUll

AS
BEGIN
   
   SET NOCOUNT ON;

   UPDATE tblProcessTracking
   SET [Pro_Type] = @ProcessType,
       [Pro_Type_PKID] = @ProcessType_PKID, 
       [Pro_Client_ID] = @ProcessClientID,
       [Pro_ClientName] = @ProcessClientname,
       [Pro_LoanNum] = @ProcessLoanNum,
       [Pro_StartDate] = @ProcessStartDate,
       [Pro_ClosedDate] = @ProcessClosedDate,
       [Pro_Sent_for_Recording] = @ProcessSentForRecording, 
       [Pro_Fully_Exec_Date] = @ProcessFullyExecDate, 
       [Pro_Doc_ID] = @ProcessDocumentID,
       [Pro_Doc_ID_Resent] = @ProcessDocumentIDResent
    WHERE tblProcessTracking.Pro_ID = @ProcessID

GO

Open in new window

Suggestions appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer

You may also find you need parentheses around your parameters:


CREATE PROCEDURE [dbo].[dls_ProcessTracking_Update]

   (

   @ProcessID int,

   @ProcessType nvarchar(10),

   @ProcessType_PKID int,

   @ProcessClientID int,

   @ProcessClientName nvarchar(50),

   @ProcessLoanNum nvarchar(50),

   @ProcessStartDate datetime,

   @ProcessClosedDate datetime = Null,

   @ProcessSentForRecording datetime = Null,

   @ProcessFullyExecDate datetime = NULL,

   @ProcessDocumentID nvarchar(15) = Null,

   @ProcessDocumentIDResent nvarchar(15) = NUll

   )

Avatar of Dale Fye

ASKER

Thanks, Scott, that resolved it.