Jump to Navigation

how to insert identity column manually in mssql

The table was as follows

CREATE TABLE [dbo].[tbl_sections](
[section_id] [int] IDENTITY(1,1) NOT NULL,
[section_name] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[upper_section_id] [int] NULL,
[folder] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[filename] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[section_url_friendly] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[mode] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[class_name] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_tbl_sections] PRIMARY KEY CLUSTERED
(
[section_id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

SET IDENTITY_INSERT tbl_sections ON
insert into tbl_sections select * from ccms_all.dbo.tbl_sections where section_id>206
SET IDENTITY_INSERT tbl_sections OFF



Main menu 2

by Dr. Radut.