Syntax for INSERTing into a table with no values?(插入没有值的表的语法?)
问题描述
我有一个使用以下架构创建的表:
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 中的一部分是 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.
推荐答案
参见 this(例如F. Load data using the DEFAULT VALUES option"):
See this (example "F. Load data using the DEFAULT VALUES option"):
INSERT INTO [Visualizations] DEFAULT VALUES;
这篇关于插入没有值的表的语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:插入没有值的表的语法?
基础教程推荐
- 在 SQL 中连接多个表 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 无法解决整理冲突 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
