Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

insert into single-columned table using t-sql

Tags:

tsql

I have a table with a single INT type column that's auto incrementing. is there a way to insert new values in that column using t-sql.

If i have a table like the following:

 CREATE TABLE [dbo].[Menu](
[MNUId] [int] IDENTITY(1,1) NOT NULL,
[MNUName] [nvarchar](250))

I can insert like so:

 INSERT INTO [Menu] (MNUName) VALUES ('menu name');

The above will automatically increment MNUId because its auto-increment is on.

but what if there is no MNUName column and I only have the MNUId colmn? What's the t-sql statement to insert into such a table?

Thanks,

like image 666
user732528 Avatar asked Apr 30 '11 15:04

user732528


1 Answers

INSERT INTO Menu DEFAULT VALUES

See the MSDN docs, DEFAULT VALUES section.

like image 91
Dustin Laine Avatar answered Oct 31 '22 07:10

Dustin Laine