CREATE PROCEDURE uspInsertImage
@PCImage varbinary(max)
As
Begin
INSERT INTO dbo.PCInfo PCImage)
VALUES (@PCImage)
End
When I Write
EXEC uspInsertPC 'D:\Desktop.jpg'
Showing Error
Implicit conversion from data type varchar to varbinary(max) is not
allowed. Use the CONVERT function to run this query.
Best Answer
You are tried to save a string into a binary column that’s why you are getting this error
You should tell SQL server to use a different source provider by using OPENROWSET
you should do something the below:
For more info have a look at the below:
http://www.databasejournal.com/features/mssql/article.php/3724556/Storing-Images-and-BLOB-files-in-SQL-Server-Part-2.htm