Questions tagged [varbinarymax]

Variable-length binary data type in Microsoft SQL Server, where 'MAX' indicates that the data may hold up to the maximum storage size of 2^31-1 bytes.

142 questions
17
votes
3 answers

Implicit conversion from data type nvarchar to varbinary(max) is not allowed

I get this exception when I try to insert a DBNull.Value into a nullable varbinary(max) field: Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query. This is my…
Pascal
  • 12,265
  • 25
  • 103
  • 195
16
votes
2 answers

Retrieve varbinary(MAX) from SQL Server to byte[] in C#

I'm trying to get a varbinary(MAX) from SQL Server to a byte[] variable in C#. How can I do this? Thanks
ePezhman
  • 4,010
  • 7
  • 44
  • 80
9
votes
3 answers

SQL Server 2008 R2 Varbinary Max Size

What is the max size of a file that I can insert using varbinary(max) in SQL Server 2008 R2? I tried to change the max value in the column to more than 8,000 bytes but it won't let me, so I'm guessing the max is 8,000 bytes, but from this article on…
9
votes
2 answers

How do I insert/retrieve Excel files to varbinary(max) column in SQL Server 2008?

I'm trying to save Excel files into the database, I do not want to use filestream as it is required to have a server for that. So how do I insert/update/select into the table that has a column of type varbinary(max)?
Darius Suwardi
  • 127
  • 1
  • 4
  • 9
8
votes
1 answer

EF6 OutOfMemoryException Evaluating Entity with varbinary(max) Property

In my WebAPI web app, I've added a varbinary(max) field to a table, and a byte[] field to the POCO (BatchCharge). This entity has a child entity (Charge). Visual Studio 2013, Entity Framework 6, SQL Server 2014. The data model is as follows: public…
7
votes
3 answers

To convert varbinary(max) to xml format

0x1F8B0800000000000400EDBD07601C499625262F6DCA7B7F4AF54AD7E074A10880601324D8904010ECC188CDE692EC1D69472329AB2A81CA6556655D661640CCED9DBCF7DE7BEFBDF7DE7BEFBDF7BA3B9D4E27F7DFFF3F5C6664016CF6CE4ADAC99E2180AAC81F3F7E7C1F3F221E7F59CFF23A7DB72897CD671FCDDB…
umapathy
  • 71
  • 1
  • 1
  • 2
5
votes
2 answers

What does VARBINARY(MAX) mean?

I'm trying to port a MSSQL database over to MariaDB and I've encountered a table creation using varbinary(max): `definition` VARBINARY(max) NULL DEFAULT NULL What would this actually do and is there an equivalent type definition in MariaDB that…
SPlatten
  • 5,334
  • 11
  • 57
  • 128
5
votes
3 answers

How can I extract the value of a varbinary(max) column?

I have a varbinary(max) column that is storing images in an SQL database. I am working on a newdb script, where an application creates a new instance of the db and populates a few of the tables. One of those tables I am working on is initializing…
James Madison
  • 337
  • 1
  • 4
  • 17
5
votes
2 answers

How to Store and Retrieve a varbinary(max) Column in SQL Server

I am developing an application in which I want to store the user's fingerprint into the database and then compare it with the one taken from the device. I've been having certain issues while converting a varbinary(max) column back to a byte[]. I…
Nosheen
  • 135
  • 1
  • 3
  • 14
5
votes
1 answer

C# Resize jpg image, convert to byte and save into database using varbinary

I'm trying to resize my jpg image uploaded by using FileUpload control and convert it into byte before saving it to database (SQL Server 2008) as (varbinary(MAX)). What I have done and code show below was that I manage to convert it into byte and…
XiAnG
  • 245
  • 2
  • 9
  • 25
4
votes
2 answers

Converting SQL Binary Content to File

I have a SQL Server database that is storing the contents of files in a table. Specifically, there are 2 fields: Contents: varbinary(max) field that always starts with '0x1F.....' FileType: varchar(5) field that has the type of file, such as PDF,…
user1383201
  • 75
  • 1
  • 6
4
votes
1 answer

Semantics of .WRITE(NULL, NULL, NULL) when updating a VARBINARY(max) column

What are the semantics of the following query UPDATE table SET column .WRITE(NULL, NULL, NULL) if column is of VARBINARY(max) type and its contents are not NULL? A quick test suggests that the query is a no-op: --DROP TABLE [table] CREATE TABLE…
krlmlr
  • 25,056
  • 14
  • 120
  • 217
3
votes
2 answers

How to update varbinary(max) column with path stored in varchar column?

I currently have a varchar(255) column that stores the path to a small image file. I want to try to load the file into a new column of type varbinary(max), but don't know how to write a stored procedure to do such. Something like such UPDATE…
Corey Blair
  • 469
  • 1
  • 7
  • 13
3
votes
2 answers

Convert C# Object to and from Varbinary using Linq to SQL

I want to be able to save any C# object in a single column of a SQL database table. I am not clear how to convert the object into a varbinary or get it back from a varbinary. My SystemContextObjects table has an OptionValue column that is…
Bob Jones
  • 2,049
  • 5
  • 32
  • 60
3
votes
3 answers

How should I be saving .doc documents to a SQL Server database

I am saving a .doc file to a SQL Server database as varbinary(max) using the C# code below. I am able to save the file, but when I retrieve the file back and want to display the contents on the web page, my code is downloading the file and I am in…
Tan
  • 778
  • 3
  • 18
  • 36
1
2 3
9 10