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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 binary

Author  Topic 

baze7
Yak Posting Veteran

58 Posts

Posted - 2010-06-08 : 11:07:05
I am still trying to figure out if there is a way to display a binary data type in a view?

Thanks

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2010-06-08 : 11:32:14
What do you mean by displaying it in a view

create table t1 (col1 binary)
insert into t1 select 1 union all select 2 union all select 3

create view viewT1
as
select col1,[recs] = count(*)
from
t1
group by col1



select * from viewt1



Works. Do you want to convert the binary into an int?

select convert(bigint,col1)
from viewt1


Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

baze7
Yak Posting Veteran

58 Posts

Posted - 2010-06-08 : 14:22:53
OK, can I just view the binary data in the grid?

in the software the field is text. in sql the type is image I am kinda confused (obviously) on the exact data. Here is what is looks like:
0x504B03041400000008000000008894A2BE00BA0000001701000005000000612E7478745D8EBD0EC3200C84F74A7D07E64E40D229531FA053562F24C10912016AA8AA16E5DD4B7EBA74399DFCD9E7CB4009052817CD267D1885BC4A1834225F35A94ED435CF80DEA5D4D96238607C9918D9BD656D3962AD2683CD529000243F2B07D84F8AA24E92B5EFB9F376A3F238040CF458494C7ADE48F58BBC9151FB72FD375ACEA70CBDB79E4A0B203D7018496BC7A1B34FCD9BC2D7BE56B951F04AC0E4E933F83EC3E528C396D5DBC343503440B0CAB8FD9794AC2494292B495F504B010214001400000008000000008894A2BE00BA00000017010000050000000000000000000000000000000000612E747874504B0506000000000100010033000000DD0000000000
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-06-08 : 15:08:23
If you want to view the content of the binary column, aka image, you have to bind the data in a proper grid or image-enabled control in the front end.
Microsoft SQL Server is not about presenting images.
You maybe can use Reporting Services to display the image.


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

baze7
Yak Posting Veteran

58 Posts

Posted - 2010-06-09 : 13:45:43
Can I convert an image to a binary, my frontend will not allow for image type
Go to Top of Page
   

- Advertisement -