4.1. INSERT

INSERT adds a new row to a table or a view.

4.1.1. INSERT Syntax

Syntax
INSERT [ INTO]
{
     table_name  [ WITH ( < table_hint_limited > [ ...n ] ) ]
   | view_name
   | OPENQUERY ( linked_server , 'query' )
   | OPENROWSET ( 'provider_name'
, {  'datasource' ; 'user_id' ; 'password'  | 'provider_string' }
, {  [ catalog. ] [ schema. ] object  | 'query' }
       )
}
{
  {  [ (
							column_list
							) ]
   {
     VALUES  ( {DEFAULT | NULL | expression } [ ,...n] )
    | SELECT-statement
							-- any valid SELECT statement that returns rows of data
							to be inserted .
							--
							Sometimes referred to as an INSERT INTO ... SELECT statement
    | execute_statement   -- any valid EXECUTE stmt that returns data with
							SELECT or READTEXT
  }
  }
| DEFAULT VALUES
}
Arguments
INSERT [INTO]
 INSERT [INTO] begins the INSERT ...

Get Transact-SQL Desk Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.