14

What the difference between

INSERT INTO table VALUES (values)

and

INSERT OVER table VALUES (values)

?

Alex
  • 2,438
  • 23
  • 30

5 Answers5

8

Of all reserved keywords, only INTO and OVER work.

SQL:2003 mentions OVERRIDING keyword to override the identity (currently only supported by DB2)

Probably, SQL Server parses it for now but does not actually implement.

The plans generated are identical, and ParameterizedText is expanded into INSERT INTO.

So as for 2008R2, the answer would be this:

No difference, except that INSERT OVER has already wasted about 50 manhours of most curious developers to the moment and there is more to go

Quassnoi
  • 413,100
  • 91
  • 616
  • 614
4

People at Microsoft say:

Thanks for reporting this issue. We keep recognizing the OVER keyword along with the INTO keyword (with the same meaning) in INSERT statements to provide backward compatibility with the previous versions of SQL Server. This should not present any problem for application development.

Eugene Zabokritski, SQL Engine

GSerg
  • 76,472
  • 17
  • 159
  • 346
2

According to this page:

http://msdn.microsoft.com/en-us/library/ms174335.aspx

INSERT OVER is not part of the defined syntax tree. Therefore, even if it works, it's probably not officially supported by Microsoft.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
  • +1 - My guess is it's some sort of accident that they left it on. Maybe got mixed-up prepositions in the code or something... – JNK Mar 28 '11 at 14:33
0

Apologies for resurrecting a dead thread, but this shows near the top of a Google search for INSERT OVER. I was hoping to find a better explanation/example here, but this link does a decent job as a starting point. If you're looking for information on the INSERT OVER DML statement (like a Merge command), take a look at this link: https://decipherinfosys.wordpress.com/2007/11/28/sql-server-2008-insert-over-a-dml-statement/

knockNrod
  • 353
  • 2
  • 10
0

Presumably INSERT OVER is supposed to overwrite an existing row in the table. For this you would actually use

UPDATE <table> SET <field=value, field2=value2> WHERE <condition to pinpoint row>
El Ronnoco
  • 11,753
  • 5
  • 38
  • 65
  • I don't think this is what he's after, actually. It's apparently undocumented syntax for an `INSERT`... – JNK Mar 28 '11 at 14:33