Difference between revisions of "Working With TSQLQuery"

From Lazarus wiki
Jump to navigationJump to search
(New page: If you ned to be able to DELETE or otherwise modify records, your database table should contain one PRIMARY KEY column that has the property AUTO_INCREMENT. This enables the DELETE method...)
 
Line 1: Line 1:
If you ned to be able to DELETE or otherwise modify records, your database table should contain one PRIMARY KEY column that has the  property AUTO_INCREMENT. This enables the DELETE method to identify the records marked for deletion in the 'WHERE' clause written back to the database.
+
If you need to be able to DELETE or otherwise modify records, your database table should contain one PRIMARY KEY column that has the  property AUTO_INCREMENT. This enables the DELETE method to identify the records marked for deletion in the 'WHERE' clause written back to the database.
 
The primary key field should preferably be designed into the table structure at CREATE time, but can be added using the following example code in your MySQL client:
 
The primary key field should preferably be designed into the table structure at CREATE time, but can be added using the following example code in your MySQL client:
 
   alter table testrig  
 
   alter table testrig  

Revision as of 01:39, 1 February 2008

If you need to be able to DELETE or otherwise modify records, your database table should contain one PRIMARY KEY column that has the property AUTO_INCREMENT. This enables the DELETE method to identify the records marked for deletion in the 'WHERE' clause written back to the database. The primary key field should preferably be designed into the table structure at CREATE time, but can be added using the following example code in your MySQL client:

 alter table testrig 
 add column autoid int 
 primary key auto_increment;

The code can, of course, be written on one line but has been broken up for clarity.