Hardcoding VARBINARY

I tried to save a hardcoded value to a VARBINARY column, and it complained that I needed to use CONVERT function

Here’s the things I tried:

– CONVERT(VARBINARY, ‘0x43d3a4334af’) : Returns 0x2333 (something other than the value)

– CAST(‘0x43d4a4334af’ AS VARBINARY) : Returns 0x21231 (something other than the value)

– Copy from another row – worked, but not a solution

Solution:

SET Column = 0x43d3a4334f (without quotes) – works!

Advertisements

About vijayvepa

I'm a software consultant for Software Specialists Inc. currently working at Philips Respironics, Pittsburgh

One comment

  1. Vijay

    Correction:This works correctly:
    INSERT INTO Clinicians(ClinicianID, EncoreID)
    VALUES(1,’0DA53C16-A07D-11DF-AF5D-E395DFD72085′)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: