You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MSSQL] Setting Bytes? (@db.VarBinary(Max)) to null throws "Implicit conversion from nvarchar to varbinary(max)" #29557
When updating a Bytes? field mapped to @db.VarBinary(Max) with null using @prisma/adapter-mssql, the query fails with an implicit type conversion error. The adapter is sending the null parameter typed as nvarchar instead of respecting the varbinary(max) column type.
The field should be set to NULL in the database without errors.
Actual behavior
DriverAdapterError: Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
at MssqlTransaction.onError (.../node_modules/@prisma/adapter-mssql/dist/index.js:709:11)
at MssqlTransaction.performIO (.../node_modules/@prisma/adapter-mssql/dist/index.js:704:12)
at MssqlTransaction.performIO (.../node_modules/@prisma/adapter-mssql/dist/index.js:722:14)
at MssqlTransaction.executeRaw (.../node_modules/@prisma/adapter-mssql/dist/index.js:692:13)
cause: {
originalCode: 'EREQUEST',
originalMessage: 'Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.',
kind: 'mssql',
code: 257
},
clientVersion: '7.8.0'
Workaround
Running raw SQL directly works correctly:
UPDATE Pessoa SET assinaturaBic =CONVERT(varbinary(max), NULL) WHERE idPessoa ='...'
Environment
prisma : 7.8.0
@prisma/client : 7.8.0
@prisma/adapter-mssql : 7.8.0
OS : Windows
Node.js : 24.15.0
Database : Microsoft SQL Server 2019
Activity
fix(adapter-mssql): set VarBinary type when null Bytes? argument is p…
fix(adapter-mssql): set VarBinary type when null Bytes? argument is p…