| | |
help on error handling in mysql ,in primary key
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2007
Posts: 1
Reputation:
Solved Threads: 0
hi ppl,i have a question.I have column which is a primary key.i have inserted a value also to it.Now again if i insert the same value it shouls not give a error.but instead continue.So how to go about it.like vb onerror is there any way that we can write the script in mysql or shell programming do reply quickly.
•
•
Join Date: May 2007
Posts: 16
Reputation:
Solved Threads: 0
hi
primary keys are meant to be unique in database, if you want to insert the same value again in the column and not get errors, then you should use surrogate key.
"surrogate key is the substitution of the primary key"
so in order to include your value again in the table, please see to that the other columns , that non attribute key should have changes or which requires updatation and keep the old values in the table.
this method will not give any error for sure.
primary keys are meant to be unique in database, if you want to insert the same value again in the column and not get errors, then you should use surrogate key.
"surrogate key is the substitution of the primary key"
so in order to include your value again in the table, please see to that the other columns , that non attribute key should have changes or which requires updatation and keep the old values in the table.
this method will not give any error for sure.
![]() |
Similar Threads
- Validation for the primary key in the database (JSP)
- find primary key of post (MySQL)
- Random unique primary key - is this possible? (MySQL)
- change primary key (MS SQL)
- generate unique primary key (MySQL)
- Primary Key Issue (Visual Basic 4 / 5 / 6)
Other Threads in the MySQL Forum
- Previous Thread: help wif uploading My sql database into Phpmyadmin.com
- Next Thread: How to count sum of values in the table?
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire laptop legal license licensing linux maintenance mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php priceupdating query referencedesign reorderingcolumns saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





