GeoVIP
GeoVIP

Reputation: 1564

STORED PROCEDURE CONVERT ERROR

Have stored procedure where i want update data and want cast some varbinary to nvarchar

UPDATE [payterm].[dict_default_values]
SET    [default_value] = CAST(@value AS NVARCHAR(MAX))
      ,[descr] = CAST(@descr AS NVARCHAR(MAX))
      ,[grp] = @grp
WHERE  [code] = @code;
IF @@ROWCOUNT = 0
    INSERT INTO [payterm].[dict_default_values]
      ([code], [default_value], [descr], [grp])
    VALUES
      (@code, @value, @descr, @grp);

When i put parametrs there were error : Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query

Upvotes: 1

Views: 114

Answers (1)

Lucero
Lucero

Reputation: 60190

You also need to cast in the VALUES part of your INSERT statement.

Without knowing the data types of your variable/parameters/columns it's difficult to give a specific answer though.

Upvotes: 1

Related Questions