Welcome Everyone Who:

Wants:

· To do right things right first time.

Does not want:

· To do things without value.

Knows that:

· Software Testing never ends, it just stops.

· Software Quality does not happen by accident; it has to be planned.

Believes that:

· There's always one more bug during Software Testing.

· Software Testing is the art of thinking.

Powered By Blogger

Wednesday, November 28, 2012

Unable to insert record into MS SQL

I needed to insert several records into MS SQL database and was getting the error message below:
"An explicit value for the identity column in table 'johndoe.dbo.xyz' can only be specified when a column list is used and IDENTITY_INSERT is ON."

After some research came across the solution. You will need to do 2 things

1) Specify column list(s) to which you are inserting the value(s).
2) Turn Identity insert On.

To turn it on:
set IDENTITY_INSERT tablename ON

To turn it off: 
set IDENTITY_INSERT tablename OFF

Hope this will save you some time!

No comments:

Post a Comment