May 24, 2012 at 8:59 am
Hi,
Thanks for coming here and reading my question.
I have one table called TRN_Image and here I have one column called vImage varbinary(Max). I am inserting data using below query.
INSERT INTO TRN_Image ( iImageID, vImage )
VALUES ( 1000, (SELECT * FROM OPENROWSET(BULK N'C:\Chand.jpg', SINGLE_BLOB) AS img1) )
It is inserting data which looks like.....(0xFFD8FFE000104A46494600010101006000600000FFDB0043000201010201010202020202020202030503030303030604040305070607070706070708090B0908080A0807070A0D0A0A0B0C0C0C0C07090E0F0D0C0E0B0C0C0CFFDB0043.....28A28A0028A28A0028A28A0028A28A0028A28A00FFD9)
I want to know that which format is this? Is it Binary, Hexa Decimal, base64, etc. Is ther any way in SQL server to view this image?
When I am inserting this same image from my iPad app using base64 data then it is different than this data and i am not able to figure it out that which format I have to use.
Thanks
Chandresh Patel
May 24, 2012 at 3:26 pm
SQL Server is unaware of the image format. You could store a Word doc or a PDF in a VARBINARY(MAX) column for all it cares. The bits are stored in a binary column, it is up to you to retrieve it and store it as a file or render it in a relevant viewer.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
May 24, 2012 at 3:30 pm
I understand that but it is storing data in Binary format or any other. Is it possible that I can store data in any format like base64, Hexa Decimal, etc.
May 24, 2012 at 3:34 pm
Hmmm, can you store hexadecimal or base64 data in a binary column, hmmm :Whistling:
Did it help to re-read that?
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
May 24, 2012 at 3:51 pm
Hi
What I mean by that is when I stored data using openrowset and I looked at data which starts with 0x so it means it is hex data. Correct? My questions is that this varninary can stored data other format?
May 24, 2012 at 3:55 pm
The 0x is how SSMS displays a binary column. It shows it as a hex-value for benefit of us humans. Internally it is only 0's and 1's.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
May 24, 2012 at 3:57 pm
Thanks for your help.
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply