I have a table having a single auto Auto Incremented column. How Can i insert the value. Using
Insert into table or some other way
Thanks Waiting for your replay..
I have a table having a single auto Auto Incremented column. How Can i insert the value. Using
Insert into table or some other way
Thanks Waiting for your replay..
CREATE TABLE products
(
Id int IDENTITY(1,1) PRIMARY KEY
)
GO
SET IDENTITY INSERT ON
INSERT INTO MyTable (Id) VALUES (2)
SET IDENTITY INSERT OFF
Without knowing your table schema it's not going to be possible to give you a good answer, but you could do something like:
insert into tableName (column2, column3, column4) values (value2, value3, value4)
Since you're using an autoincrement column you don't need to specify it when inserting data.
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=90116
provided some insight here.
INSERT INTO TableName DEFAULT VALUES
you can either
insert into tableName ()
either "insert into tableName VALUES (NULL)" where NULL is the first and only column value of the row (the syntax is
insert into tableName(column2, column3) VALUES (value2, value3)
as provided by Michael. )