Sunday, February 19, 2012

Implicit conversion from datatype nvarchar to varbinary(MAX)

I am runnning SQL Server 2005...one of my columns is set to Varbinary(MAX), but when I try and set it to null, I get this error, when calling a stored procedure from C#.

'Implicit conversion from datatype nvarchar to varbinary(MAX) is not allowed. Use the CONVERT function to run this query.'

Thanks

Murph

are you sure you are passing null and not 'null' ?

take a look at this

--good
declare @.v Varbinary(MAX)
select @.v = null
select @.v
go


--bad, will fail
declare @.v Varbinary(MAX)
select @.v = 'null'
select @.v
go

Denis the SQL Menace
http://sqlservercode.blogspot.com/

|||I am trying to find out...I am using an ORMapper, and I am guessing it is doing something like you mentioned.|||

check your parameter datatype on your C# Code..

No comments:

Post a Comment