Pushing database changes needn't be hard work with SQL Compare
Getting Started with Adobe After Effects - Part 6: Motion Blur
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.
Submit a Tip
Loading
Nirav
37 · 5% · 1593

Learned it

Liked it

Knew it

Did you learn something today? Share It!

SQL Server - Insert value manually in IDENTITY Column by using IDENTITY_INSERT ON

Dec 8 2011 5:43AM by Nirav   Edit
If you have the requirement of inserting values into identity column, by setting "IDENTITY_INSERT" to ON, we can insert the values into table.
SET IDENTITY_INSERT dbo.MyTable ON;
INSERT INTO dbo.MyTable
(
    IdentityColumnID,
    ProductName
)
VALUES
(
    1,
    'socks'
);
SET IDENTITY_INSERT dbo.MyTable OFF;


1
Liked
0
Learned
1
Knew









Submit
Send to my friends
Subscribe to Nirav

1   Comments   

Subscribe to Notifications
  • Do you have any idea how can i convert a existing integer column to identity.

    Say for e.g. i have a "ID" column which is int, later on i want to change it to identity. How can i do that?

    commented on Jan 3 2012 4:46AM  .  Report Abuse This post is not formatted correctly
    Jatin
    3197 · 0% · 1

Your Comment


Sign Up or Login to post a comment.

Managed Windows Shared Hosting by OrcsWeb

Copyright © Rivera Informatic Private Ltd.