How to enable IDENTITY_INSERT for a table

21 Nov

I wonder how many times every one  us might have stumbled to insert values to identity column.Though identity
column serves as healthy mean of maintaining unique identification for a table and more often then not we do use
identity column to be the primary key field but it does come with it’s own baggage of hindrance, ofcourse until
you know how to unload the baggage

One hindrance that identity column serves is that does not allow you to enter your desired value at a particular
place until you play this little trick with it.While the simplest solution that i have used often to get across this situation
is here to unrevealed.

INSERT IdentityTable(TheIdentity, TheValue)
VALUES (3, ‘here we go’)

This is one of those  little trick that every sql programmer would love to be  scrolled in their sleeves

Leave a comment

Posted by on November 21, 2012 in Uncategorized


Tags: ,

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: