Hi Gurus,I have created a simple SP to insert records into a table. The table also calls a function to generate an ID (PK). While the procedure has been created without any trouble, it throws an error on being called.create procedure InsertRequestMaster@cUnit nchar(10),@cRequestno nchar(75) = '30 WG/LGS/1234/GIFTING',@dRequestDt datetime ,@dRecdDt datetime ,@dRegnDate datetime ,@cRemarks varchar(100) = NULL--@cRequestType nchar (4),--@nAfQty int,--@nAeQty intASBEGIN DECLARE @cNextId char(8) BEGIN TRANSACTION; -- Store nextId in a variable --SELECT @dRequestDt = GETDATE() --SELECT @dRecdDt = GETDATE() --SELECT @dRegnDate = GETDATE() SELECT @cNextId= DBO.GETID(GETDATE()) INSERT INTO RequestMaster ( RequestId, Unit, RequestNo, RequestDt, RecdDt, RegnDt, Remarks) VALUES (@cNextId, @cRequestno, @cUnit, @dRequestDt, @dRecdDt, @dRegnDate, @cRemarks); UPDATE IdMaster set LastId = @cNextId COMMIT TRANSACTION;END
I call it like soEXEC InsertRequestMaster @cUnit='30 WG', @dRequestDt=getdate(), @dRecdDt=getdate(), @dRegnDate=getdate()
The error is quote:
Msg 102, Level 15, State 1, Line 2Incorrect syntax near ')'.