Error:
Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query.
Any question? I am new to SQL Server
USE schemas
GO
CREATE PROCEDURE Table
@LineaNegocioId INT, --null
@PaisId INT, -- required
@AreaId INT, --required
@Nombre VARCHAR(100), --required
@Descripcion VARCHAR(100), --required
@fechaCreacion DATETIME, --required
@fechaUltimaModificacion DATETIME --null
AS
BEGIN
SET NOCOUNT ON
INSERT INTO Table (LineaNegocioId, PaisId, AreaId, Nombre, Descripcion, fechaCreacion, fechaUltimaModificacion)
VALUES (@LineaNegocioId, @PaisId, @AreaId, @Nombre, @Descripcion, @fechaCreacion, @fechaUltimaModificacion)
SET NOCOUNT OFF
END
Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query. The problem is that the query plan hashes are already in binary format, however stored as VARCHAR in the XML Query Plan e.g.
varbinary [ ( n | max ) ]Variable-length binary data. n can be a value from 1 through 8,000. max indicates that the maximum storage size is 2^31-1 bytes. The storage size is the actual length of the data entered + 2 bytes. The data that is entered can be 0 bytes in length.
The VARBINARY data type holds variable-length binary data. Use this type when the data is expected to vary in size. The maximum size for VARBINARY is 8,000 bytes. As an aside, the word VARBINARY stands for varying binary.
Even though BINARY and VARBINARY are binary byte data types, they have differences when it comes to storage. BINARY stores values in fixed lengths while VARBINARY stores in variable depending on the type of values. Values in BINARY data type are padded with 0x00 which is not the case with VARBINARY.
Either the field Nombre
or Descripcion
is a varbinary
and you must explicitly convert
those inputs for your insert
clause.
It would look like this.
VALUES (... ,CONVERT(varbinary, [@Nombre or @Descripcion]) ,...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With