- #1
SlurrerOfSpeech
- 141
- 11
Could use some help figuring out the error
Operand type clash: numeric is incompatible with uniqueidentifier
which points to the specified line below
The table Partners is of the form
Any help in figuring out this error? What I'm trying to do is return from the procedure the guid that was just assigned to the row that was just inserted.
Operand type clash: numeric is incompatible with uniqueidentifier
which points to the specified line below
Code:
CREATE PROCEDURE AddPartner
@name NVARCHAR(50), @email NVARCHAR(254), @new_guid UNIQUEIDENTIFIER OUTPUT
AS
BEGIN
SET NOCOUNT ON
INSERT INTO Partners (name,email) VALUES (@name,@email)
SELECT @new_guid = SCOPE_IDENTITY() -- specified line
RETURN
END
The table Partners is of the form
Code:
CREATE TABLE Partners (
id UNIQUEIDENTIFIER NOT NULL DEFAULT NEWID(),
name NVARCHAR(50) NOT NULL,
email NVARCHAR(254) NOT NULL, -- 254 is optimal length according to http://stackoverflow.com/questions/1199190/what-is-the-optimal-length-for-an-email-address-in-a-database
PRIMARY KEY (id)
);
Any help in figuring out this error? What I'm trying to do is return from the procedure the guid that was just assigned to the row that was just inserted.