Sunday, 15 February 2015

sql server - EF4 insert data via scripts -


I know that by default EF code first sets StoreGeneratedPattern = Identit it's OK. But I want to include some part of the data via the SQL script. I know that at the time only one table can be on the SET IDENTITY_INSERT rules;

But when I try to run

  USE [GameDatabase] GO GO ON ATNSINNLS SET QUOTED_IDENTIIFIER SET - Rules on Game SET IDENTITY_INSERT RulesOfGames; RulesOfGames (RulesOfGameId, MaxScore, IsPossibleEqualsScore) INSERT (1, 20, 1) in values; SET IDENTITY_INSERT RulesOfGames OFF; - Kindsport SET IDENTITY_INSERT RulesOfGames on; Include in prices (KindSportId, Name, RulesOfGame_RulesOfGameId) Value (1, 'ÑÑ ?? Ñ ?? Ð ± оР»', 1); SET IDENTITY_INSERT Consort of Off;   

I get an error and I want to set a specific ID to set up a special argument set.

  Message 8107, Level 16, State 1, Line 3 IDENTITY_INSERT Table 'GameDatabase.dbo.KindSports' is already running for table 'RulesOfGames' SET can not perform action for   

How can I solve my problem?

set IDENTITY_INSERT RulesOfGames; RulesOfGames (RulesOfGameId, MaxScore, IsPossibleEqualsScore) INSERT (1, 20, 1) in values; SET IDENTITY_INSERT RulesOfGames OFF; - Kindsport SET IDENTITY_INSERT type assistance; Include in prices (KindSportId, Name, RulesOfGame_RulesOfGameId) Value (1, 'ÑÑ ?? Ñ ?? Ð ± оР»', 1); SET IDENTITY_INSERT Consort of Off;

No comments:

Post a Comment