本文介绍了插入与插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 MS SQL 中使用 T-SQL 已经有一段时间了,每当我必须将数据插入到表中时,我都倾向于使用语法:

I have been working with T-SQL in MS SQL for some time now and somehow whenever I have to insert data into a table I tend to use syntax:

INSERT INTO myTable <something here>

我知道关键字 INTO 在这里是可选的,我不必使用它,但不知何故,它在我的情况下养成了习惯.

I understand that keyword INTO is optional here and I do not have to use it but somehow it grew into habit in my case.

我的问题是:

  • 使用INSERT 语法和INSERT INTO 有什么影响吗?
  • 哪一项完全符合标准?
  • 它们在 SQL 标准的其他实现中都有效吗?
  • Are there any implications of using INSERT syntax versus INSERT INTO?
  • Which one complies fully with the standard?
  • Are they both valid in other implementations of SQL standard?

推荐答案

INSERT INTO 是标准.尽管 INTO 在大多数实现中是可选的,但在少数实现中是必需的,因此最好包含它以确保您的代码可移植.

INSERT INTO is the standard. Even though INTO is optional in most implementations, it's required in a few, so it's a good idea to include it to ensure that your code is portable.

您可以在此处找到指向多个版本的 SQL 标准的链接.我在此处找到了旧标准的 HTML 版本.

You can find links to several versions of the SQL standard here. I found an HTML version of an older standard here.

这篇关于插入与插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 06:06