SQL server and problems with auto increment field

A

Anonymous

Guest
Im working with an SQL database and PHP. I'm having problems inserting data into fields that are auto increment. What I would do when working with mysql, is something like: insert into tablename values ('', 'field1', 'field2');
where the initial '' is for the auto increment field. When I do this with mssql, it tells me I cannot insert NULL values. Why doesnt this work. Included is a screen shot of the column that should be auto increment.


sc.JPG
 
Try and insert '0', i do this with php+mysql and it works as long as the field is marked as auto increment.
 
Thing is, the database manager is very sonfusing, the image i included doesnt seem to work, but it has the settings of that column, could you check if auto increment is "on" ?
image:

http://page-builder.org/sc.JPG
 
try not even adding something from the first column when u insert something, like start from the second column
 
From the picture i cannot tell if the auto increment property is on and i don´t see any info on it. Try and have a look to the documentation so that you know how to set the auto increment parameter on.
If you dont get a solution, try and use another primary key, such as a social security number or something like that.
Another way would be to select the last entry and sum one to the primary key (thats what auto increment is btw). That's not very smart, but i cant tell another way.

Cheers.
 
just make inserts in the main columns (NOT AUTO INCREMENT COL.) chek if the values increase or not...
or else

Code:
show create table your_table_name
use the above code to see if the field was set to auto_increment
 
Back
Top