Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Posts
    12

    Unanswered: Image Data and PATINDEX function

    Hi,

    I need to retrieve the offset of some text stored as image. PATINDEX does not work for image data type. What other choice do I have?

    Thank you,
    Amar Das

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    Are you searching for the text or the binary pattern of the text?

    Use the image datatype for storing binary data and (n)text datatype for storing text.
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Feb 2003
    Posts
    12
    Thanks Paul.

    I am searching for the text. Unfortunately the table is created by my client and I can not alter it.

  4. #4
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    Hum... Books Online seems to have some errors...

    try this...
    Code:
    create table #Tmp(f1 text, f2 image)
    insert into #Tmp values('Test number 1','Test number 1')
    insert into #Tmp values('Test number 2','Test number 2')
    insert into #Tmp values('Test number 3','Test number 3')
    insert into #Tmp values('Test number 4','Test number 4')
    select charindex(cast('r 2' as varbinary),f2),* from #Tmp
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •