IF you're using SQL Server, you should really look up the IDENTITY specification. It lets you do this with ease and speed.
Your solution isn't unique because things can happen so fast in the system that two processes, either running in sequence or concurrently, can get the same tick value.