I have a webApi which registers orders, using a stored procedure, assigning the creation date = SYSDATETIME()
. Every request registers one unique order.
The problem is than two different requests to my Api, in the same second, separated less than 200 milliseconds, that generate two different calls to my stored procedure (practically separated by a few milliseconds), are registered with the same date, exactly the same, with precission of milliseconds.
for example:
- order 1: 100001 -> creation date = 2020-12-01 01:01:01.1234567
- order 2: 100002 -> creation date = 2020-12-01 01:01:01.1234567
This is the code in my stored procedure
declare @date datetime2
select @date = SYSDATETIME()`
Theorically the sql function SYSDATETIME() doesn't repeat values, but in my case, they are repeated (several times in my database in different dates).
Any idea of what's happening?