IDENTITY_INSERT error?????
Posted: Wed Apr 30, 2003 3:53 am
HI im using ms sql server database, and on my website i have a form that when submitted has an id. I want this id to increment automatically.
The following piece of code submits the info into the database but its not incrementinthe id:
If i dont use the set identity_insert i get an error. Any ideas on how i could fix this or is there other ways of automatically incremting the id ???
Thanx for any advice!!
The following piece of code submits the info into the database but its not incrementinthe id:
Code: Select all
<?php
$Q03 = "SET IDENTITY_INSERT cust_call_log ON INSERT INTO $dbcall2(id_num,company_name,Username,date,time,call_type,description) VALUES('','$company_name','$Username','$date','$time','$call_type','$description')SET IDENTITY_INSERT cust_call_log OFF ";
$R03 = odbc_exec($db,$Q03) or die("Bad Q03:".mysql_error());
$Q03 = "SET IDENTITY_INSERT logged_cust_calls ON INSERT INTO $dbcust_log(id_num,company_name,date)VALUES('','$company_name','$date')SET IDENTITY_INSERT OFF logged_cust_calls";
$R03 = odbc_exec($db,$Q03) or die("Bad Q03:".mysql_error());
?>Thanx for any advice!!