Select Image Field which does contain data

  • Hi gurus,

    I have a table with Image field which suppose to store the wav files. I want to list the records only the records which has a wav file.

    it should like

    Select * from Tablename Where ImageField <> ''




    My Blog: http://dineshasanka.spaces.live.com/

  • have you tried:

    Select * from Tablename Where Substring(ImageField ,8,4) ='WAVE'

    HTH

     


    * Noel

  • Well, can u to a substring function for a image field? I doubt.




    My Blog: http://dineshasanka.spaces.live.com/

  • Well, You shouldn't

    create table mytable ( i int, dta image)

    insert into myTable (i , dta) values( 1 , 'TESTING IMAGE')

    select i, dta , cast(substring(dta,1,4) as char(4)) Str

    from mytable

    Results:

    i           dta                                            Str

    ----------- -----------------------------  ----

    1           0x54455354494E4720494D414745   TEST

    (1 row(s) affected)

     

    by the way you will have to cast the substring in my previous post

     

    HTH

     


    * Noel

  • thankx it works!!!




    My Blog: http://dineshasanka.spaces.live.com/

  • Why not store the content type in a separate field?  That way you are not casting on an image field.  Seems faster and clearer if done that way.

    Mike

  • Do you store content other than WAV files in this field? If not, isn't the field NULL if there's no WAV file? If so then

    Select * from tablename where imagefield is null

    would seem to be the best way...

     

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply