vendredi 26 août 2016

MSSQL, PHP update Column to varbinary from navchar error

So I have this table column AgentsView (varbinary(max), null)

And I'm trying to update that column with a new binary, but i keep getting this error [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Implicit conversion from data type nvarchar(max) to varbinary(max) is not allowed. Use the CONVERT function to run this query.

I have tried numerous things to bypass this obstacle. Here is a few attempts that generates the same errormessage

update [dbo].[Agents] set [AgentsView] = 0x1EFBBBF3C587472615365726
update [dbo].[Agents] set [AgentsView] = '0x1EFBBBF3C587472615365726'
update [dbo].[Agents] set [AgentsView] = '1EFBBBF3C587472615365726'
update [dbo].[Agents] set [AgentsView] = Cast('1EFBBBF3C587472615365726' as varbinary(max))
update [dbo].[Agents] set [AgentsView] = Convert(varbinary(max), '1EFBBBF3C587472615365726')
update [dbo].[Agents] set [AgentsView] = Convert(varbinary(max), 0x1EFBBBF3C587472615365726)
update [dbo].[Agents] set [AgentsView] = Convert(varbinary(max), '0x1EFBBBF3C587472615365726')

I am using PHP and have also tried to cast the variable like this

$newData = (binary) . "1EFBBBF3C587472615365726"

But i cant understand why I am still getting the same message as before.

Any suggestions?

Regards



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire