Jul 25, 2008

Microsoft SQL - you can ommit the INTO clause in insert statement?

I am not quite sure if this is a known feature / bug, but it is possible to write

INSERT Products (ProductName)
VALUES ('TestProduct')

instead the "standard":

INSERT INTO Products (ProductName)
VALUES ('TestProduct')

I repeat, I am not quite sure if this is standard behaviour for Microsoft SQL Server, and for which versions. I am not quite sure even if it is valid for all INSERT scenarios you may face, but I tried few different scenarious which include insertion of rows and it works like charm.

Note: I will suggest you to stick with the
INSERT INTO as it seems "more standard" to me. Furthermore if you are using some tools to do some SQL work (tools which may need to parse your
SQL) you will probably need to change back to INSERT INTO if you have used INSERT.

2 comments:

Anonymous said...
This comment has been removed by a blog administrator.
Павелъ Дончевъ said...
This comment has been removed by the author.