Igor, I know that it will show error when we try to insert a value which is already there in the database when that field is a primary key. But I want to check it out and I don't want that number to be inserted into the database. I was asking about a method which finds this. I don't want to terminate the program and have other numbers in a loop to be inserted into the database.
Original Message----- From: Igor Tandetnik [mailto:[EMAIL PROTECTED] Sent: Monday, May 29, 2006 7:52 PM To: SQLite Subject: [sqlite] Re: Check for duplicate values in database Anish Enos Mathew <[EMAIL PROTECTED]> wrote: > I created a table as follows. > > create table data_table(seq_number integer primary key,data > text,curr_date text)",NULL, NULL, NULL); > > I want to insert 100 records into the database randomly. Here > "seq_number" is the primary key. Is there any method by which I can > check whether a randomly selected number which I am going to insert in > the database already exists in the database or not? Being a primary key, the database engine will enforce its uniqueness. Just try to insert and check for errors, the operation will fail if this key already exists. Igor Tandetnik The information contained in, or attached to, this e-mail, contains confidential information and is intended solely for the use of the individual or entity to whom they are addressed and is subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email. www.aztecsoft.com