[Cialug] SQL Question: Advanced INSERT INTO

Kenneth Younger kyounger at gmail.com
Fri Sep 3 14:50:22 CDT 2010


Correct. If it's an auto_increment "counter", then just specify NULL as the
value for that column and it will handle the auto increment.

On Fri, Sep 3, 2010 at 2:47 PM, Eric Junker <eric at eric.nu> wrote:

> On 9/3/2010 2:34 PM, Todd Walton wrote:
> > I'm wondering, if I need to do an INSERT INTO a table, and the table
> > has a counter for a primary key, how do I handle setting the counter?
> > I don't know beforehand what it should be, and it could change second
> > by second.  Would something like this work?:
>
> Are you using MySQL? If so, it is probably an auto_increment primary
> key. You don't need to specify it when inserting as it will
> automatically increment and set the primary key when you insert.
>
> http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html
>
> Eric
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cialug.org/pipermail/cialug/attachments/20100903/15e95aa1/attachment.htm 


More information about the Cialug mailing list