SQL 如何在SQL表中插入空行?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13605208/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 12:21:12  来源:igfitidea点击:

How to insert an empty line to SQL table?

sqlsql-servertsql

提问by Hari Seldon

Possible Duplicate:
Inserting rows into a table with one IDENTITY column only

可能的重复:
将行插入到只有一个 IDENTITY 列的表中

I have a SQL table with just one column. Column is an autoincrement field like:

我有一个只有一列的 SQL 表。列是一个自动增量字段,如:

Id INT IDENTITY

I need to insert a rows to this table (this is a bulk/dummy table temporarily):

我需要在这个表中插入一行(这是一个临时的大容量/虚拟表):

INSERT INTO my_table VALUES ()

But I'm got a syntax error.

但是我遇到了语法错误。

How can I do this?

我怎样才能做到这一点?

回答by gbn

INSERT INTO my_table DEFAULT VALUES 

回答by Philipp

Try to insert explicit null values:

尝试插入显式空值:

INSERT INTO my_table VALUES (NULL, NULL);