This comes in handy when performing a mass insert from a table without a primary key to a table with an AUTO_INCREMENT value. A common tecnique simply inserts blank values to the AUTO_INCREMENT column. Doing so generates a warning for each row. Generating a bunch of warnings makes it difficult to identify and address the other warnings that may occur. Using my tecnique to generate incremental values addresses this problem.
SET @INC = 15;
SELECT
@INC:=@INC+1 AS 'Record Number',
`column1`,
`column2`,
`etc`
FROM
`table1`;
« REGEX Notes « Previous Article
Next Article » Non-Stick Suckerfish »
The contents, design, and development of this site are all done by me, Ethan Kent.
The contents of my site, ethanmultimedia.com, are for general information only and provided strictly as is. I do my best to be truthful and accurate, but I must expressly disclaim any implied warranties of non-infringement, merchantability and fitness for a particular purpose. Browse this site at your own risk. If you’re looking for safety and assurance you should probably seek the advice of an appropriate professional.