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. Checking Duplicate values in Database

Checking Duplicate values in Database

Scheduled Pinned Locked Moved Database
csharpdatabasequestioncsshelp
3 Posts 3 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.
  • C Offline
    C Offline
    codingrocks
    wrote on last edited by
    #1

    I wrote a query for getting some values from database , and and bind it to grid. Now i want to add new values, but before that i wanna check whether there are entries of the same values... How can I do this...? a friend suggested to add some conditions to the same stored proc to get this done.. Please help me...?

    SAJAN A PILLAI C#.NET Programmer TELESOFT INDIA PVT LTD... BANGALORE "Winners don't do different things. They do things differently. ...

    P S 2 Replies Last reply
    0
    • C codingrocks

      I wrote a query for getting some values from database , and and bind it to grid. Now i want to add new values, but before that i wanna check whether there are entries of the same values... How can I do this...? a friend suggested to add some conditions to the same stored proc to get this done.. Please help me...?

      SAJAN A PILLAI C#.NET Programmer TELESOFT INDIA PVT LTD... BANGALORE "Winners don't do different things. They do things differently. ...

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

      Do a select to check if the duplicate criteria is there and then insert if nothing matches. You could do this with an IF NOT EXISTS query. Alternatively, create a unique index on these fields and rely on the database catching it.

      Deja View - the feeling that you've seen this post before.

      1 Reply Last reply
      0
      • C codingrocks

        I wrote a query for getting some values from database , and and bind it to grid. Now i want to add new values, but before that i wanna check whether there are entries of the same values... How can I do this...? a friend suggested to add some conditions to the same stored proc to get this done.. Please help me...?

        SAJAN A PILLAI C#.NET Programmer TELESOFT INDIA PVT LTD... BANGALORE "Winners don't do different things. They do things differently. ...

        S Offline
        S Offline
        Skanless
        wrote on last edited by
        #3

        Are u checking for duplicate values in a Database or a table? If it is a table the you use the following script. SELECT count(Column(s)) FROM table_Name ORDER BY Column(s) GROUP BY column(s) HAVING Count(Column(s)) > 1 Hope this helps.

        Skan If you knew it would not compile why didn't you tell me?!?!?!

        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