Create table and set one column auto generated number SQL server



Open the SQL server management studio and select a database, which you want to create the table in the database.

Click on SQL Server Management Studio
 
After opened, you need to select the database from the dropdown list
 
 
/****** Object: Table [dbo].[tbl_users] Script Date: 25-04-2020 23:43:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_tableUser](
[Id] [bigint] IDENTITY(1,1) NOT NULL, // "IDENTITY" this is the create auto increment number in ID column
[password] [nvarchar](50) NOT NULL,
[name] [nvarchar](max) NOT NULL,
[email] [nvarchar](250) NOT NULL,
[mobile] [nvarchar](50) NULL,
[pinCode] [nvarchar](50) NULL,
[address1] [nvarchar](max) NULL,
[address2] [nvarchar](max) NULL,
[city] [nvarchar](50) NULL,
[state] [nvarchar](50) NULL,
[country] [nvarchar](50) NULL,
[types] [nvarchar](50) NULL,
[status] [int] NULL,
[createdDatetime] [datetime] NULL,
[createdBy] [nvarchar](50) NULL,
[updatedDatetime] [datetime] NULL,
[updatedBy] [nvarchar](50) NULL,
CONSTRAINT [UQ__tbl_tableUser__AB6E6164E4176D4A] UNIQUE NONCLUSTERED
(
[email] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

0 Comment's

Comment Form

Submit Comment