When using CRYPT_GEN_RANDOM to populate a column constrained by a Foreign Key I found that false (and seemingy impossible) constraint violation errors were raised. Upon further investigation I found that this only happened when there is a merge join leading into the assert operator. When the plan has a nested loops no such errors are raised.There is no Sort operator between the clustered index insert and the Merge Join. The only circumstances in which this would be valid would be if all the newly inserted rows had the same value returned by CRYPT_GEN_RANDOM however this is not the case.So CRYPT_GEN_RANDOM seems to be treated in the plan as though it behaved in the same manner as rand() and is evaluated once per query. However this is not the actual behaviour of the function.
Version
Category
Operating System
Platform
Please wait...