Reputation: 2160
What is the difference between 1st col and 2nd col
select cast(img as varchar(max)), img
from table_name;
I want to store images in SQL Server.
Which of the following is appropriate?
varbinary v/s nvarchar
Using SQL Server 2008
Upvotes: 1
Views: 117
Reputation: 754220
Since an image is binary data, you should definitely pick VARBINARY(MAX)
to store it inside your SQL Server table. (N)VARCHAR
is for textual data (not binary).
For the same reason, the first part of your query
SELECT CAST(img AS varchar(max)),
really makes no sense - what to you expect when you're casting binary data into textual form? It will be gibberish that you get - no useful information...
Upvotes: 1