Skip to main content
added 84 characters in body
Source Link
Aaron Bertrand
  • 181.5k
  • 28
  • 402
  • 619

This is a known behavior change that was reported on Connect and closed as "by design"design." You'll notice that the docs for 2008 & 2014 are slightly different, partially to reflect that the output of e.g.commands like DBCC CHECKIDENT() (2008 vs. 2014) better reflectsreflect reality.

The workaround you're using now is as good as any I can think of, since there is no magic trace flag to change the behavior of either version. It does seem odd to me that you prioritize your tests over the code. You should be making your tests so that they can interpret all code paths, not changing the code to match the one output the test expects. I have to wonder why the test even cares what surrogate ID value is generated by the database, because you shouldn't IMHO. These should be invisible to users and only used for referential integrity.

This is a known behavior change that was reported on Connect and closed as "by design". You'll notice that the docs for 2008 & 2014 are slightly different, partially to reflect that the output of e.g. DBCC CHECKIDENT() (2008 vs. 2014) better reflects reality.

The workaround you're using now is as good as any I can think of, since there is no magic trace flag to change the behavior of either version. It does seem odd to me that you prioritize your tests over the code. You should be making your tests so that they can interpret all code paths, not changing the code to match the one output the test expects. I have to wonder why the test even cares what surrogate ID value is generated by the database, because you shouldn't IMHO.

This is a known behavior change that was reported on Connect and closed as "by design." You'll notice that the docs for 2008 & 2014 are slightly different, partially to reflect that the output of commands like DBCC CHECKIDENT() (2008 vs. 2014) better reflect reality.

The workaround you're using now is as good as any I can think of, since there is no magic trace flag to change the behavior of either version. It does seem odd to me that you prioritize your tests over the code. You should be making your tests so that they can interpret all code paths, not changing the code to match the one output the test expects. I have to wonder why the test even cares what surrogate ID value is generated by the database, because you shouldn't IMHO. These should be invisible to users and only used for referential integrity.

Source Link
Aaron Bertrand
  • 181.5k
  • 28
  • 402
  • 619

This is a known behavior change that was reported on Connect and closed as "by design". You'll notice that the docs for 2008 & 2014 are slightly different, partially to reflect that the output of e.g. DBCC CHECKIDENT() (2008 vs. 2014) better reflects reality.

The workaround you're using now is as good as any I can think of, since there is no magic trace flag to change the behavior of either version. It does seem odd to me that you prioritize your tests over the code. You should be making your tests so that they can interpret all code paths, not changing the code to match the one output the test expects. I have to wonder why the test even cares what surrogate ID value is generated by the database, because you shouldn't IMHO.