I have written the following SQL Stored Procedure, and it keeps giving me the error at
@pid = SELECT MAX(... The whole procedure is:
Alter PROCEDURE insert_partyco
@pname varchar(200)
AS
BEGIN
DECLARE @pid varchar(200);
@pid = SELECT MAX(party_id)+1 FROM PARTY;
INSERT INTO party(party_id, name) VALUES(@pid, @pname)
SELECT SCOPE_IDENTITY() as PARTY_ID
END
GO
Can anyone please tell me what I'm doing wrong here?
idcolumn auto-increment, though I'm not sure why you've declaredpidas a varchar when it appears to be an int value...