Here is a primary example: I have a varbinary field in sql server that stores and image. I need to determine the middle of the image grab the 4 digit byte and use that to determine the color. I have no idea how I determine what to look at in that field and then what part of the image field I look at to determine the proper color.
Here is what we have:
select
WHEN dbo.prod_Color.ColorGraphic IS NULL
THEN 'FFFFFF'
WHEN SUBSTRING(dbo.prod_Color.ColorGraphic,5, 1) = 0x02
THEN
CONVERT(varchar(2), SUBSTRING(dbo.prod_Color.ColorGraphic, 135, 1), 2)
+ CONVERT(varchar(2), SUBSTRING(dbo.prod_Color.ColorGraphic, 134, 1), 2)
+ CONVERT(varchar(2), SUBSTRING(dbo.prod_Color.ColorGraphic, 133, 1), 2)
WHEN SUBSTRING(dbo.prod_Color.ColorGraphic, 5, 1) = 0x03
THEN
CONVERT(varchar(2), SUBSTRING(dbo.prod_Color.ColorGraphic, 157, 1), 2)
+ CONVERT(varchar(2), SUBSTRING(dbo.prod_Color.ColorGraphic, 156, 1), 2)
+ CONVERT(varchar(2), SUBSTRING(dbo.prod_Color.ColorGraphic, 155, 1), 2)
ELSE
'FFFFFF'
END AS HtmlColor
it was previously determined that we could use the substring 5, 1 and that indicated 2 types of bmp format... then do a case statement on it. I don't believe this to be correct but regardless we've been tasked with finding the middle byte and using that value to do the compare.
Has anyone done this or can you give me a kick start in what to do.