Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server Binary(16) in c#

Tags:

c#

sql-server

I have a table with some columns: 1. nvarchar(30), 2. int, 3. binary(16). Now, In c# I have a class that represents those columns:

public string aaa { get; set; }
public int bbb { get; set; }

And how do I write the third one (binary(16)) ?

like image 399
David Avatar asked Aug 21 '16 11:08

David


People also ask

What is the max size of varbinary?

varbinary [ ( n | max ) ] n can be a value from 1 through 8,000. max indicates that the maximum storage size is 2^31-1 bytes. The storage size is the actual length of the data entered + 2 bytes.

What is a varbinary data type?

VARBINARY: A variable-width string up to a length of max-length bytes, where the maximum number of bytes is declared as an optional specifier to the type. The default is the default attribute size, which is 80, and the maximum length is 65000 bytes. VARBINARY values are not extended to the full width of the column.

What is binary string in SQL?

A binary string is a sequence of bytes. Unlike a character string which usually contains text data, a binary string is used to hold non-traditional data such as pictures. The length of a binary string is the number of bytes in the sequence. A binary string has a CCSID of 65535.


1 Answers

Binary column is commonly mapped to byte arrays:

public byte[] ThirdColumn {get; set;}
like image 63
Sergey Kalinichenko Avatar answered Oct 11 '22 16:10

Sergey Kalinichenko