Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data Type Image: Is it possible to get the file format ?
Message
 
À
02/11/2007 17:18:04
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01266205
Message ID:
01266217
Vues:
10
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform