Check for the Duplicates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ganeshkumar08
    New Member
    • Jan 2008
    • 31

    Check for the Duplicates

    Hi SQL friends,

    I friends i need to check whether the record is already available..
    ie. Before Inserting and Updating which are the validations to be done.

    I need a standard solution for this.

    Using SELECT and WHERE clause we can able to check for the availability, but i need a standard which are followed in the company.

    Can any one you please send me the query.

    Thanks and Regards
    Ganesh kumar V
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    The easiest way is to deny duplicates in the table settings.
    But I am not sure what you are getting at.

    Comment

    • amitpatel66
      Recognized Expert Top Contributor
      • Mar 2007
      • 2358

      #3
      Originally posted by ganeshkumar08
      Hi SQL friends,

      I friends i need to check whether the record is already available..
      ie. Before Inserting and Updating which are the validations to be done.

      I need a standard solution for this.

      Using SELECT and WHERE clause we can able to check for the availability, but i need a standard which are followed in the company.

      Can any one you please send me the query.

      Thanks and Regards
      Ganesh kumar V
      Create a BEFORE INSERT OR UPDATE TRIGGER on a table to check if the data that is inserted already exist?
      If yes, then do an UPDATE, else INSERT the new record in to database.

      Comment

      • ganeshkumar08
        New Member
        • Jan 2008
        • 31

        #4
        Originally posted by amitpatel66
        Create a BEFORE INSERT OR UPDATE TRIGGER on a table to check if the data that is inserted already exist?
        If yes, then do an UPDATE, else INSERT the new record in to database.
        In SQL Server BEFORE INSERT OR UPDATE TRIGGER is available?
        If available means can u give me a sample code..

        Comment

        • ck9663
          Recognized Expert Specialist
          • Jun 2007
          • 2878

          #5
          Read more here

          -- CK

          Comment

          Working...