Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Binary Datatype

Author  Topic 

Red Army
Starting Member

2 Posts

Posted - 2006-06-14 : 21:52:29
Quick question here. I am working with a database which uses Binary(8) as an id(ie, contact_id is binary(8), and connects 2 tables). I can already extract the binary data (in the form 00-00-00-00-00-00-ab-cd). I know that there exists a contact_id 0x0000000000001989 (hex) however, when I attempt this query...

"SELECT * FROM Support_Incident where Contact_Id = '0x0000000000001989'". I get no results. What have I done wrong?

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-06-14 : 22:21:38
Don't enclose the binary string in quotes.

SELECT * FROM Support_Incident where Contact_Id = 0x0000000000001989


CODO ERGO SUM
Go to Top of Page

Red Army
Starting Member

2 Posts

Posted - 2006-06-15 : 00:22:21
wow, I can't believe I didn't try that.... you'd be surprised what i did try though. Thanks
Go to Top of Page

miky001@yahoo.com
Starting Member

5 Posts

Posted - 2007-11-30 : 13:16:34
Why is it that when I run a query in the Enterprise Manager as "SELECT COL_ID FROM TABLENAME", I get 'Binary' as the result vs when I run the same exact query, I get the actual binary data (eg. 0x00000000001201) in the result? Also, how do I convert the binary into readable text format in the SELECT statement? Thanks in advance

Miky001
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-11-30 : 13:52:38
Instead of posting your question on an old topic, you should should just start a new topic.




CODO ERGO SUM
Go to Top of Page
   

- Advertisement -