|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Saturday, April 27, 2013 5:33 AM
Points: 109,
Visits: 390
|
|
hello all. I want to insert into identity column and i want to first remove identity property and insert value and then enable identity property.I use this script:SET IDENTITY_INSERT IdentityTable ON
INSERT IdentityTable(TheIdentity, TheValue) VALUES (3, 'First Row')
SET IDENTITY_INSERT IdentityTable OFF but get error :Cannot insert explicit value for identity column . ho w do i do for this goal?please guide me.thanks
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 6:11 PM
Points: 286,
Visits: 523
|
|
Permissions issue? IDENTITY_INSERT requires that you are the owner of the table or are a member of db_owner or db_ddladmin on the database.
Have you correctly qualified the table name with the schema?
Clare _________________________________________________________________________________________________________________ Measure twice; cut once (and have a good saw)
Hey, just a thought.....did you check Books Online yet?
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Saturday, April 27, 2013 5:33 AM
Points: 109,
Visits: 390
|
|
| I login with sa.is that enough?how to member of db_owner or db_owner?
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 6:11 PM
Points: 286,
Visits: 523
|
|
Permissions are not the issue then if you're a member of sysadmins.
I'm not sure what else can be the issue; its a fairly straightforward process usually. When you run SET IDENTITY_INSERT IdentityTable ON; do you get any error message?
Clare _________________________________________________________________________________________________________________ Measure twice; cut once (and have a good saw)
Hey, just a thought.....did you check Books Online yet?
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Saturday, April 27, 2013 5:33 AM
Points: 109,
Visits: 390
|
|
sa is db_owner and when I select dbo.ddladmin for my database ,get error:can not use the special principal dbo. how do i do?
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Saturday, April 27, 2013 5:33 AM
Points: 109,
Visits: 390
|
|
my error just is: An explicit value for the identity column in table 'WOS_WorkOrderType' can only be specified when a column list is used and IDENTITY_INSERT is ON.
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 6:11 PM
Points: 286,
Visits: 523
|
|
As I said in my last post, if you're running the code as a member of sysadmins then permissions are not a problem and you don't need to do anything.
Are you getting any error message when you execute SET IDENTITY_INSERT IdentityTable ON; ?
Clare _________________________________________________________________________________________________________________ Measure twice; cut once (and have a good saw)
Hey, just a thought.....did you check Books Online yet?
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Saturday, April 27, 2013 5:33 AM
Points: 109,
Visits: 390
|
|
my error : An explicit value for the identity column in table 'WOS_WorkOrderType' can only be specified when a column list is used and IDENTITY_INSERT is ON. and I have only this error
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 6:11 PM
Points: 286,
Visits: 523
|
|
Ok, so I do this...
SET IDENTITY_INSERT dbo.TestTable ON and get this...
Command(s) completed successfully.
What message do you get?
Clare _________________________________________________________________________________________________________________ Measure twice; cut once (and have a good saw)
Hey, just a thought.....did you check Books Online yet?
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Saturday, April 27, 2013 5:33 AM
Points: 109,
Visits: 390
|
|
yes get command complete succesfully. but when insert into identity table get error: An explicit value for the identity column in table 'WOS_WorkOrderType' can only be specified when a column list is used and IDENTITY_INSERT is ON.
|
|
|
|