CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge -> General/Other

 SQL

Print topic Send  topic

Author Message
Juan
Posted: 01/07/2005, 3:57 PM

I am kind of toying around with sql. And I want to add an auto increment statement into the ID field of a contacts table:

INSERT INTO contacts (ID) VALUE (NULL)

Since I've never worked with sql before I'm not sure where to place the sql statement in cc.

I built a form with serveral data entry fields on it and I have the ID field hidden.

My thought was to see how this all works, enter data into the form, press the insert button, post the data to the db and at the same time generate the autonumber.

Can someone give me a little guidance.

Thanks,

Juan
mrachow


Posts: 509
Posted: 01/09/2005, 12:52 AM

Simply INSERT a record without giving ID. The ID will created during insert.

Most of database systems allow inserting of autoincrement columns but you have to give a valid nonexisting value. So your inserting of null won't work anyway.

In some cases you would like to have the just generated ID back. Here the database systems differ. I think SQL Server for example is using a stored procedure to retrieve the key for you.
_________________
Best regards,
Michael
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.