I want to change varchar
to varbinary(max)
in SQL Server with this query:
ALTER TABLE [dbo].[Attachments]
ALTER COLUMN [Content] varbinary(max) NOT NULL
but this throws the following exception:
Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query
What should I change in this situation ?
Best Answer
Are you sure you want varbinary(max)? If so, I believe you need to do this in steps:
Depending on the nature of the table, it might be faster to convert it via a select into:
Then drop the old table and rename the new: