SSIS and Sql Server Journey

Personal Notes of Sarabjit Singh and Bhavpreet Singh

Explicitly insert data into identity column : Sql Server

on June 11, 2012

To insert data into Identity Column
Set identity_insert table_name ON
Explicitly specify the column names of the table in which data is to be inserted
Set identity_insert table_name OFF

set identity_insert table_name ON
insert into table_name(identity_column_name,second_column_name) values
(21, 'text 1'),
(23, 'text 2'),
(24, 'text 3')
set identity_insert table_name OFF

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: