Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How do I Compare Thumb Image by the Select Statement in SQL Server 2005....?

How do I Compare Thumb Image by the Select Statement in SQL Server 2005....?

Scheduled Pinned Locked Moved Database
databasehelpquestionsql-serversysadmin
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Manish_Kumar_Nayak
    wrote on last edited by
    #1

    hi, I am using SQL Server 2005 database. I stored Thumb Image on two tables to the Image data type field. When I compare these two images from both table is gives error... "The data types image and image are incompatible in the equal to operator" Statement : "Select FP1 From E_CH16APPLICANTS Where FP1 In (Select Photo From Tmp)" I just like to verify that this Thumb Image is exist or not... by using SQL Statement... Pls help me...

    L G 2 Replies Last reply
    0
    • M Manish_Kumar_Nayak

      hi, I am using SQL Server 2005 database. I stored Thumb Image on two tables to the Image data type field. When I compare these two images from both table is gives error... "The data types image and image are incompatible in the equal to operator" Statement : "Select FP1 From E_CH16APPLICANTS Where FP1 In (Select Photo From Tmp)" I just like to verify that this Thumb Image is exist or not... by using SQL Statement... Pls help me...

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      check for NULL or DBNULL, or use IsNull; or something like that. No need to actually compare anything if I understood your question correctly. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      M 1 Reply Last reply
      0
      • L Luc Pattyn

        check for NULL or DBNULL, or use IsNull; or something like that. No need to actually compare anything if I understood your question correctly. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

        M Offline
        M Offline
        Manish_Kumar_Nayak
        wrote on last edited by
        #3

        Exactly I want to know... Can I Compare two Images stored in the Table...?????

        L 1 Reply Last reply
        0
        • M Manish_Kumar_Nayak

          hi, I am using SQL Server 2005 database. I stored Thumb Image on two tables to the Image data type field. When I compare these two images from both table is gives error... "The data types image and image are incompatible in the equal to operator" Statement : "Select FP1 From E_CH16APPLICANTS Where FP1 In (Select Photo From Tmp)" I just like to verify that this Thumb Image is exist or not... by using SQL Statement... Pls help me...

          G Offline
          G Offline
          Goutam Patra
          wrote on last edited by
          #4

          One LIKE operation may help you to compare two image field. Here [^] is a link on Brief Tutorial on Text, Ntext, and Image. You will also find a example how to compare two image column

          M 1 Reply Last reply
          0
          • M Manish_Kumar_Nayak

            Exactly I want to know... Can I Compare two Images stored in the Table...?????

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            I'm no database expert at all, however I've never seen SQL code that compares big fields (blobs, images), and I expect that whenever you (think you) need it, you have a bad design to start with; there should be no doubt that the image, when present, is the right one (the only doubt I would allow for is whether the image is present at all); and IMO it would most always be wise to have a separate field that uniquely identifies the image (a hash or CRC would probably be fine). The only way I know to compare two blobs/images is by using a programming language (say C#), fetch the two blobs and compare their elements in a loop. :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

            1 Reply Last reply
            0
            • G Goutam Patra

              One LIKE operation may help you to compare two image field. Here [^] is a link on Brief Tutorial on Text, Ntext, and Image. You will also find a example how to compare two image column

              M Offline
              M Offline
              Manish_Kumar_Nayak
              wrote on last edited by
              #6

              Convert Image field in Varbinary(Max) Ex: Select * From E_CH16APPLICANTS Where (Convert(VARBINARY(MAX), FP1) In (Select Convert(VARBINARY(MAX), Photo) From Tmp)

              P L 2 Replies Last reply
              0
              • M Manish_Kumar_Nayak

                Convert Image field in Varbinary(Max) Ex: Select * From E_CH16APPLICANTS Where (Convert(VARBINARY(MAX), FP1) In (Select Convert(VARBINARY(MAX), Photo) From Tmp)

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #7

                Never use select *. As a shortcut, it leads to bad programming habits and it can lead to hard to find bugs as columns get renamed in the underlying database. You should always choose to explicitly select columns instead, partly because using

                select *

                typically results in columns being retrieved that aren't needed in the result set.

                I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

                Forgive your enemies - it messes with their heads

                My blog | My articles | MoXAML PowerToys | Onyx

                1 Reply Last reply
                0
                • M Manish_Kumar_Nayak

                  Convert Image field in Varbinary(Max) Ex: Select * From E_CH16APPLICANTS Where (Convert(VARBINARY(MAX), FP1) In (Select Convert(VARBINARY(MAX), Photo) From Tmp)

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Manish_84 wrote:

                  Convert Image field in Varbinary(Max)

                  It'd be 'sweet' if you could create a hash to represent your image, and store that in a column next to the image itself :)

                  I are Troll :suss:

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups