Questions tagged [varbinary]

varbinary is the SQL Server datatype used to hold variable-length binary data

SQL Server's varbinary datatype is declared with a length specification in the CREATE TABLE statement:

CREATE TABLE tablename (..., colName varbinary(n), ...)

where n is the maximum size of the column in bytes (limited to a maximum of 8000), or the word MAX if more than 8000 bytes might need to be stored. (The absolute maximum size is approximately 2gb as of this writing; consult SQL Server documentation for the exact current maximum.)

For more information, see this entry in the SQL Server online documentation.

411 questions
12
votes
4 answers

How can I generate an INSERT script for a table with a VARBINARY(MAX) field?

I have a table with a VARBINARY(MAX) field (SQL Server 2008 with FILESTREAM) My requirement is that when I go to deploy to production, I can only supply my IT team with a group of SQL scripts to be executed in a certain order. A new table I am…
Issa Fram
  • 2,556
  • 7
  • 33
  • 63
12
votes
2 answers

Upload a file to a varbinary with SQL Management Studio

Is there any way to upload a file to a varbinary with SQL Management Studio without writting a manual SQL query ?
Patrice Pezillier
  • 4,476
  • 9
  • 40
  • 50
12
votes
2 answers

Converting from base64 string to varbinary(max) in SQL Server

I have PDF documents stored in my table as binary, the column that stores the bytes for the PDFs is type varbinary(max). I want to update one record with an updated document in SQL Studio, the way I am attempting to accomplish this is like…
esausilva
  • 1,964
  • 4
  • 26
  • 54
11
votes
1 answer

why is CONVERT string to VARBINARY in SQL Server only converting first character?

I am using NLog to log in my application and as part of that we are logging the customer number, which is a string in C#, and a varbinary(32) in the database. I am using the following SQL code for this specific parameter. The rest of the SQL…
ClaytonHunt
  • 533
  • 1
  • 7
  • 19
10
votes
2 answers

How to script VARBINARY to copy it from one DB to another using a script?

I need to generate an SQL insert script to copy data from one SQL Server to another. So with .net, I'm reading the data a given SQL Server table and write this to a new text file which can then be executed in order to insert this data on other…
Marc
  • 9,012
  • 13
  • 57
  • 72
9
votes
2 answers

Best datatype to store hexidecimal and hex characters in the database

I'm using the Ethereum api. I want to store the information from the api into a mysql table. The address data looks…
Yada
  • 30,349
  • 24
  • 103
  • 144
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…
8
votes
1 answer

How to store varbinary in MySQL?

Just a quick question.. Out of two options mentioned below, how to store to varbinary column in MySQL? public_key = '67498930589635764678356756719' or public_key = 67498930589635764678356756719 Will the second method work? I am into an emergency…
Nirmal
  • 9,391
  • 11
  • 57
  • 81
8
votes
2 answers

SQL: Sequentially doing UPDATE .WRITE on VarBinary column

I'm trying to create a little test application which reads chunks of a FileStream and appends it to a VarBinary(max) column on an SQL Server 2005 Express. Everything works - the column gets filled as it's supposed to, but my machine still seems to…
d0rk
  • 93
  • 1
  • 4
7
votes
1 answer

MySQL case insensitive search on varbinary field?

I have a varbinary field id like to do a case-insensitive search on. I know that the way varbinary fields work prohibits you from doing something like so: WHERE LOWER(page_title) = LOWER("Gasket") So is there a way to do this? I imagine I could…
Adam Meyer
  • 1,505
  • 1
  • 19
  • 28
7
votes
1 answer

varbinary to varchar w/o master.dbo.fn_varbintohexstr

Is there any way to convert varbinary to ASCII varchar string (base64, md5, sha1 - no matter) without master.dbo.fn_varbintohexstr function on MS SQL Server 2005? Because it can't be used inside of computed column. CONVERT and CAST return non-ASCII…
Denis
  • 3,653
  • 4
  • 30
  • 43
7
votes
3 answers

SQL Server 2008 convert varchar to varbinary

I try to import image data into a sql server 2008 db with code like this: INSERT INTO [TAB] (ID_PHOTO,PHOTO) VALUES( CAST('333EFB54-7062-E043-F088-FE0A916C0297' as uniqueidentifier), CONVERT(varbinary(max),'0xFFD8FFE000') ) The string is…
Thomas Dorloff
  • 111
  • 1
  • 1
  • 5
7
votes
4 answers

How to improve performance in SQL Server table with image fields?

I'm having a very particular performance problem at work! In the system we're using there's a table that holds information about the current workflow process. One of the fields holds a spreadsheet that contains metadata about the process (don't ask…
Paulo Santos
  • 11,285
  • 4
  • 39
  • 65
7
votes
5 answers

Oracle 10: Using HEXTORAW to fill in blob data

We have a table in Oracle with a BLOB column that needs to be filled with a small amount of arbitrary byte data--we will never put in more than 4000 bytes of data. I am working with an existing C++ OCI-based infrastructure that makes it extremely…
StilesCrisis
  • 15,972
  • 4
  • 39
  • 62
6
votes
1 answer

Length of varbinary(max) filestream on SQL Server 2008

Is there some efficient way how to get length of data in "varbinary(max) filestream" column? I found only samples with conversion to varchar and then calling the "LEN" function.
TcKs
  • 25,849
  • 11
  • 66
  • 104
1
2
3
27 28