This is baffling me!
I have a proc that will call another proc to clear a record (if one exists) before adding a new one. Both procs work fine and the table ends up correct. However, I've noticed that the proc that clears the record logs that it executed at exactly the sime timeas the new record. This means that I can't see the correct order in my log table. Obviously, as the clearing proc runs BEFORE the proc that adds the new record, it should write it's log record first. The clearing proc runs at least three statements before the second one.
No problem I thought, I'll just drop a WAITFOR DELAY '00:00:00.001' after the clearing proc so that they are at least a millisecond apart and that will fix it.
Trouble is, it doesn't. The still come in at exactly the same time. If I make the delay a second, it works, but that's crap.
waitfor delay '00:00:00.001'
And I seem to get some spurious results for anything less than 10 miliseconds.
Any ideas? Have I found a bug? Do I win a prize?