Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Type Image: Is it possible to get the file format ?
Message
 
To
02/11/2007 17:18:04
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01266205
Message ID:
01266217
Views:
9
This message has been marked as a message which has helped to the initial question of the thread.
>No, no file name, neither format.

Get the info from that Image field to your FrontEnd and the check the format with the function Sergey pointed. Translate it to your favorite FronEnd language :-)
Here the same function with T-SQL:
declare @Temp Table (Fld1 image NULL)
INSERT INTO @Temp VALUES (NULL)

SELECT CASE WHEN SUBSTRING(Fld1,1, 3) = Char(255)+Char(216)+Char(255)
                 THEN 'JPG'
            WHEN SUBSTRING(Fld1,1, 3) = 'GIF'
                 THEN 'GIF'
            WHEN SUBSTRING(Fld1,1, 3) = 'EMF'
                 THEN 'EMF'
            WHEN SUBSTRING(Fld1,1, 3) = 'PNG'
                 THEN 'PNG'
            WHEN SUBSTRING(Fld1,1, 2) = 'BM'
                 THEN 'BMP'
            WHEN SUBSTRING(Fld1,1, 3) = 'CWS' AND ASCII(SUBSTRING(Fld1,4, 1)) < 16
                 THEN 'SWF'
            WHEN SUBSTRING(Fld1,1, 3) = 'FWS' AND ASCII(SUBSTRING(Fld1,4, 1)) < 16
                 THEN 'SWF'
            WHEN SUBSTRING(Fld1,1, 4) = Char(215)+Char(205)+Char(198)+Char(154)
                 THEN 'WMF'
            WHEN SUBSTRING(Fld1,1, 4) = Char(77)+Char(77)+Char(7)+Char(42)
                 THEN 'TIF'
      ELSE 'Don''t know' 
      END AS Test
FROM @Temp
Tested on SQL Server 2005 only. With tested I mean I run this code and it didn't gave me an error :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform