my question is how to create a table from php (only the query) in mSsql and add an autoincrement value. With that it wont be necessary to add the value manually in an insert query.
Here is my template:
$query = "CREATE TABLE [table].[myTable](id numeric(18) AUTO_INCREMENT, project varchar(10), name varchar(50), path varchar(500), categorie varchar(50)) ";
thanks :)
Disclaimer - I have
zerominimal knowledge about Microsoft SQL Server.. I'm a MySql guy myself...
I believe the keyword you are looking for is IDENTITY
.
$query = "CREATE TABLE [table].[myTable](id int IDENTITY(1,1), project varchar(10), name varchar(50), path varchar(500), categorie varchar(50))";
Syntax -
IDENTITY [ ( seed , increment ) ]
The seed is the value used for the first record inserted into the table and the increment value (as the name shows) is the amount to increment that seed for each other record.