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
0
votes
2 answers

How to set varbinary column in SQL server

I am trying to update column of type VARBINARY(MAX) by following SQL: UPDATE dbo.__MigrationHistory SET Model = 0x1F8B080000000000046 WHERE MigrationId = '201510051415248_Test2' And I am expecting that column to be set to 0x1F8B080000000000046 but…
Vladimirs
  • 8,232
  • 4
  • 43
  • 79
0
votes
0 answers

MySQL VARBINARY WHERE string comparison not working

I have a MySQL table with fields that are varbinary. They contain strings that are indexed for quick lookup. On one server, lookups seem to work just fine. On another server, they return empty sets. What is causing the discrepancies across the…
Mikey A. Leonetti
  • 2,834
  • 3
  • 22
  • 36
0
votes
1 answer

What is the default charset for MySQL varbinary string interpretaion?

Sometimes I would use varbinary instead of varchar, especially when I need trailing white-spaces to count during = comparison and am not interested in using the LIKE operator for this purpose. When selecting, I can specify which charset to use when…
700 Software
  • 85,281
  • 83
  • 234
  • 341
0
votes
0 answers

reading varbinary from MySQL - or hiding sensitive information from the console

I have a field that holds an AES_ENCRYPT value in MySQL. I'm using varbinary as the field type. I need to pass this value to JavaScript (this field contains emails of users - which I do not want them to be readable from the console) so I wanted the…
Nami Nam
  • 91
  • 2
  • 9
0
votes
2 answers

Buffer.BlockCopy does not work more than one time

I have a class that each time it receives buffer and it should append to a bigger byte array but it do the block copy only the first time, and then it does not copy anything the first time buffer enters the class it copy the content in allData. but…
laila
  • 15
  • 1
  • 2
  • 7
0
votes
1 answer

SQL Server VarBinary to VB Variable

I have a table in SQL Server that has a number of columns. One of these columns is a varbinary(4000). Essentially I need to take several rows in the table and use the values in the columns. This includes the varbinary(4000) value. However I am…
Regis
  • 166
  • 4
  • 17
0
votes
2 answers

SQL Server indexing - varchar(100) vs varbinary(100)? [convert data]

Is it better to set an index (primary or secondary) on a varchar(x) or varbinary(x) column? I wasn't sure it even mattered. However what I see online (Googled - varchar vs varbinary) is that varchar is almost dead or being pushed to the way side.…
0
votes
1 answer

How do I cast to varbinary and be still be able to perform a CONVERT on the sql side? Implications?

I'm writing this application that will allow a user to define custom quizzes and then allow another user to respond to the questions. Each question of the quiz has a corresponding datatype. All the responses to all the questions are stored…
Biff MaGriff
  • 8,102
  • 9
  • 61
  • 98
0
votes
1 answer

How to read varbinary of SQL as string in C#?

I have an web application which reads varbinary from SQL as a byte array in code. Basically it does a ExecuteScalar of the column and returns it as a byte array. I am now doing a mini version of the application as a Windows application. For this, I…
Divakar
  • 652
  • 2
  • 7
  • 18
0
votes
2 answers

Store/retrieve files to/from SQL Server database

I want to allow users to attach files to a project. Files can be images, documents, texts, zip files etc. I have created a table in my database which will store file name, extension, size, comments about files and the file data. Column type for…
WAQ
  • 2,556
  • 6
  • 45
  • 86
0
votes
2 answers

GetBytes in C# not returning correct value

I have a method that execute stored procedure and returns values of that stored procedure. I have a VIN that in SQL is in VarBinary type. I am not sure what can I use to get the value. This is my code: // Get Customer Product By CustomerID …
Alma
  • 3,780
  • 11
  • 42
  • 78
0
votes
1 answer

how to display binary image to image box?

I have to display student name and image on my web page while selecting student id from the drop down list. The image is stored in var binary format on db. How can I retrieve the image and display on image box. The given below code is only shows the…
Vipin
  • 261
  • 6
  • 20
  • 44
0
votes
1 answer

Query optimization for convert VARBINARY to VARCHAR and charindex on it

I have a repository table which has around 18.7 million rows and every month around 500 thousand to 100 thousand rows are added. The table structure is as follows CREATE TABLE [dbo].[my_table]( [id] [bigint] NULL, [a_timestamp] [datetime]…
Ram
  • 3,092
  • 10
  • 40
  • 56
0
votes
1 answer

Using Replace And Convert with varbinary

I need a query that will find part of a string in a varbinary and remove on the requested part of the string For example my table dbo.inventory_table has to columns CharacterIdx and Data. Data is the target column which contains varbinary so for…
0
votes
1 answer

Mdf file growing too large inserting binary data

I'm taking jpegs and inserting them into a table as a byte array in a varbinary(MAX) data type field. However, the mdf file is growing three to four times larger in size the the total size of all of the files I'm inserting. I'm using a standard c#…
jdf35w
  • 29
  • 2