MS SQL Server Concepts and Programming Question:
Download Questions PDF

How To Insert a New Row into a Table with "INSERT INTO" Statements in MS SQL Server?

Answer:

To insert a new row into a table, you can use the INSERT INTO statement with values specified for all columns as in the following syntax:

INSERT INTO table_name VALUES (list_of_values_of_all columns)

Note that the list of values of all columns must be specified in the same order as how columns are defined in the CREATE TABLE statement. The following tutorial example inserts a row into "ggl_links":

INSERT INTO ggl_links VALUES (101,
'www.globalguideline.com',
NULL,
0,
'2006-04-30')
GO
(1 row(s) affected)

SELECT * FROM ggl_links
GO
id url notes counts created
101 www.globalguideline.com NULL 0 2006-04-30

The values are stored in the new record nicely.

Download MS SQL Server Interview Questions And Answers PDF

Previous QuestionNext Question
How To Create a Testing Table with Test Data in MS SQL Server?How To Use Column Default Values in INSERT Statements in MS SQL Server?