You are here: Re: Example of binary data type in SQL Server « MsSQL Server « IT news, forums, messages
Re: Example of binary data type in SQL Server

Posted by ZeldorBlat on 10/01/76 11:38

Water Cooler v2 wrote:
> There are two datatypes for storing binary data type in the SQL Server:
>
> 1. binary - for fixed length binary data
> 2. varbinary - for variable length data
>
> My question is: how is data inserted into them? Do they have any
> delimiters that go into the insert statement like strings and datetimes
> have? What format (hex/decimal?) do they accept data in? Can you please
> give me an insert statement example?

Apparently Celko forgot about the part where you answer the question.

I've always done it by encoding it in hex first. Then you can do
something like this:

insert myTable (myBinaryColumn) values (0x8d7e6a5d4b3e2e1f)

Just put the 0x before whatever hex value you come up with. The
difference between the two is the same as the difference between char
and varchar. In general, if the values in that column are either short
or all roughly (or exactly) the same length, use binary. Otherwise,
use varbinary.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация