Sql – Implicit conversion from varchar to Varbinary how to

sqlsql serversql-server-2008

I got the following error trying to convert from a varchar to varbinary..

Implicit conversion from data type
varchar to varbinary(max) is not
allowed. Use the CONVERT function to
run this query.

and this is the alter command that I tried.

alter table foo Alter column bar varBINARY(max)

So how do I use the convert function for something like this? I did a bit of searching via google and had no luck.

Thanks.

Best Answer

You have to rebuild the table.

Use SSMS designer to change the type: this will generate a script with CONVERT.