Home > Archive > MS SQL Server MSEQ > May 2005 > Working With Binary Data Types









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Working With Binary Data Types
Tom Glasser

2005-05-17, 9:23 am

I am looking at a table, using Enterprise Manager, that has several fields
defined
as Binary. All I seem to be able to see is the literal "<Binary>" in these
fields.
How can I view the actual values in these fields? How do I do a selection
criteria on them?

Thanks,
Tom

Hugo Kornelis

2005-05-18, 7:24 am

On Tue, 17 May 2005 07:10:04 -0700, Tom Glasser wrote:

>I am looking at a table, using Enterprise Manager, that has several fields
>defined
>as Binary. All I seem to be able to see is the literal "<Binary>" in these
>fields.
>How can I view the actual values in these fields? How do I do a selection
>criteria on them?


Hi Tom,

Use Query Analyzer instead of Enterprise Manager.

CREATE TABLE test
(a int NOT NULL PRIMARY KEY,
b varbinary(80) NOT NULL)
go
INSERT INTO test (a, b)
SELECT 1, CAST(123435 AS varbinary(80))
go
-- Display binary data
SELECT b
FROM test
WHERE a = 1
go
-- Selection based on binary data
SELECT a
FROM test
WHERE b = 0x0001E22B
-- or: WHERE b = CAST(12345 AS varbinary(80))
go
DROP TABLE test
go


Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com