I have a table where stock ticks are stored in the 2008 sql server. It is used in the character column and in the date column, which is datetime2. In C # applications, inserts are sent at a high speed to the table. Currently, a string is created using the character and DateTime.Now, and then inserted. Sometimes a situation may arise when it includes 2 ticks for one character and the datetime.now time will return to the same time, up to a millisecond. My question is how can I assure that my inserts do not use the same time for a given character. I fiqure I could have another unique key, for example, rowver or somenind autonumber in db as one solution, but even if the insert was successful, I do not want there to be duplicate time for this character.I also thought about saving the last insert time and just adding a millisecond to it if it is equal. I am not sure if this is the best way. In addition, datetime2 loops have more precession than .net date, so I donβt know if I will try to solve this problem on the server or client.
thanks
I want to keep every insertion no matter what, and for performance reasons, I donβt want to check the old values, so the solution that I will go for is an identity column. This will allow me to keep the insertion order by allowing duplicates in datetime2.
RBear source
share