插入到没有值的表中的语法? [英] Syntax for INSERTing into a table with no values?

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

问题描述

我有一个使用以下架构创建的表:

I have a table created with the following schema:

CREATE TABLE [dbo].[Visualizations]
(
    VisualizationID     int identity (1,1)      NOT NULL
)

由于表没有可设置的字段,所以我不确定如何插入记录.我试过了:

Since the table has no settable fields, I'm not sure how to insert a record. I tried:

INSERT INTO [Visualizations];
INSERT INTO [Visualizations] () VALUES ();

均无效.正确的语法是什么?

Neither work. What is the proper syntax to do this?

由于许多人似乎对我的表感到困惑,因此它仅用于表示许多子表的父表...每个子表都由FK引用此表,而每个子表都由FK引用.这些FK中有PK,因此在所有这些表中,ID都是唯一的.

Since a number of people seem confused by my table, it is used purely to represent a parent of a number of sub-tables... each one references this table by FK and each of those FKs are PKs, so that across all of those tables, the IDs are unique.

推荐答案

请参见

See this (example "F. Load data using the DEFAULT VALUES option"):

INSERT INTO [Visualizations] DEFAULT VALUES;

这篇关于插入到没有值的表中的语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆