Running into problems with a SQL Server 2008 stored procedure: I keep getting the following error.
Conversion failed when converting from a character string to uniqueidentifier.
Here's the stored procedure - I've chopped a lot of it out for testing
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE RateReview
@ProfileKey INT
,@ReviewKey NVARCHAR(36)
,@Rating BIT
,@Result NVARCHAR(16) OUTPUT
AS
BEGIN
SET NOCOUNT ON;
SET @ReviewKey = 'NotFound'
DECLARE @ReviewID INT = 0
DECLARE @VisitorProfileID INT = 0
DECLARE @ReviewRatingID INT = 0
DECLARE @VotedUp BIT = 0
DECLARE @Temp UNIQUEIDENTIFIER
SET @Temp = CONVERT(UNIQUEIDENTIFIER, @ReviewKey)
-- Commented code here
END
GO
I try to call this with the standard Management Studio "Execute" menu option, which given me this:
DECLARE @return_value int,
@Result nvarchar(16)
EXEC @return_value = [dbo].[maxi_content_RateReview]
@ProfileKey = 1985118925,
@ReviewKey = N'4D051C99-1D59-4BB0-BFB9-D26786B5C809',
@Rating = 1,
@Result = @Result OUTPUT
SELECT @Result as N'@Result'
SELECT 'Return Value' = @return_value
GO
I've checked that the GUID is correct and tried with both CAST and CONVERT - always the same problem. Any ideas? It's driving me nuts!