Query to Get Image data type

  • Hi,

        I want to know how to get image data type value. I crated a table with One Image data type column

    create

    table Test(MetaInfo image)

    Next i inserted One value

    insert

    into Test values('True')

    How to read the value in the Test table of MetaInfo Column.

    Note:- Don't ask me why you need to store this short information in Image data type. I'm in need of this situation.

    Otherwise tell me is it possible to store information like Result='True' in the image data type and using query can we retrieve the Result Corresponding Result

    Regards,

    Vinoth

     

     

     

     

  • I'm not gonna ask why... but this will be a performance killer :

    create table Test(MetaInfo image)

    insert into dbo.Test (MetaInfo) values('True')

    Select cast(cast(MetaInfo as varbinary(50)) as varchar(50)) as MetaInfo from dbo.Test

    --True

    DROP Table Test

  • usually Substring is the recommended function for this

    select Substring(MetaInfo, 1, 8) as FileType from dbo.Test

    hth

     


    * Noel

  • You know better... I never use that datatype.

  • I have used it only on very limited occations that I have come across a design which is ussually not mine

     

     


    * Noel

  • That's more like it .

    Shall we dare to ask him why he's doing that?

  • I hope this is a backfill of some column, because the right thing will be to populate the type at insert time and not to query the image column

     

     


    * Noel

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

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