Syntax for INSERTing into a table with no values?

SqlSql ServerTsqlInsert

Sql Problem Overview


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?

Edit: 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.

Sql Solutions


Solution 1 - Sql

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

INSERT INTO [Visualizations] DEFAULT VALUES;

Solution 2 - Sql

Trigger the identity insert with null

insert into
            Visualizations
values
           (null);

Solution 3 - Sql

Maybe you need to add a dummy column to do this, and just insert NULL into it, the dummy column would allow for NULLs. Although your table structure does not make sense, I would suggest this in order for it to work.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavid PfefferView Question on Stackoverflow
Solution 1 - SqlAnton GogolevView Answer on Stackoverflow
Solution 2 - SqlSophie88View Answer on Stackoverflow
Solution 3 - Sqlt0mm13bView Answer on Stackoverflow