How can I insert a value into a table in sql server 2000, 2005, 2008?

I have a table that has one autorepeatable extra column. How can I insert the value. Using

Insert into table or in some other way

Thanks. Awaiting your playback.

+2


a source to share


5 answers


http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=90116

provided some insight here.



INSERT INTO TableName DEFAULT VALUES

      

+4


a source


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

      



+1


a source


Without knowing the table schema you won't be able to give you a good answer, but you can do something like:

insert into tableName (column2, column3, column4) values (value2, value3, value4)

      

Since you are using an autoincrement column, you do not need to specify it when inserting data.

0


a source


INSERT INTO tableName (columnName1, ...) VALUES (value1, ...);

      

0


a source


you can either

insert into tableName ()

      

or "insert values ​​(NULL) into TABLENAME", where NULL is the first and only value in the row column (syntax

insert into tableName(column2, column3) VALUES (value2, value3)

      

as Michael did. )

0


a source







All Articles