Showing posts with label constants. Show all posts
Showing posts with label constants. Show all posts

Sunday, March 25, 2012

binary varbinary question

What is the documented and known behavior of inserting hex constants into a
binary/varbinary column from a client to a server which have different code
pages? Will any code page / character set conversion take place?
eg: insert into t1 values ('AA') or insert into t1 values(x'AA')
Thanks
AakashYou can specify a binary (hex) constant as 0x followed by the character
representation of the hex string. These are not enclosed in quotes.
For example:

INSERT INTO t1 VALUES(0xAA)

This is documented in the SQL Server 2000 Books Online
<tsqlref.chm::/ts_ca-co_1n1v.htm>. Since the value is not a character
value, no character conversion occurs.

--
Hope this helps.

Dan Guzman
SQL Server MVP

--------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index...epartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--------

"Aakash Bordia" <a_bordia@.hotmail.com> wrote in message
news:bf4j62$688$1@.hanover.torolab.ibm.com...
> What is the documented and known behavior of inserting hex constants
into a
> binary/varbinary column from a client to a server which have different
code
> pages? Will any code page / character set conversion take place?
> eg: insert into t1 values ('AA') or insert into t1 values(x'AA')
> Thanks
> Aakash