[ACCEPTED]-SQL Server Insert Without INTO-insert

Accepted answer
Score: 24

The INTO is optional. It is required in ANSI sql but 2 the MS/Sybase developers decided to make 1 it optional.

Score: 6

Check the BNF grammar http://savage.net.au/SQL/

92, 99, SQL:2003

<insert statement> ::= INSERT INTO <insertion target> <insert columns and source>

According 5 to the ANSI spec, INTO should only be optional 4 in a MERGE clause.

For SQL Server (this link from 2000 to 3 show how old it is - it exists from the 2 first version of SQL Server), it is optional. It 1 is also optional for MySQL.

INSERT [ INTO]
    { table_name WITH ( < table_hint_limited > [ ...n ] )
        | view_name
        | rowset_function_limited
    }

    {    [ ( column_list ) ]
        { VALUES
            ( { DEFAULT | NULL | expression } [ ,...n] )
            | derived_table
            | execute_statement
        }
    }
    | DEFAULT VALUES 
Score: 4

From MSDN:

INTO is an optional keyword that 1 can be used between INSERT and the target table.

http://msdn.microsoft.com/en-us/library/aa933206%28v=sql.80%29.aspx

Score: 0

You mention that this comes from an early 2 version of SQL. If you have 2005 onwards 1 running now you can drop the INTO.

More Related questions