title: Database trigger or application code? which one should I use in this case?
body: <p>Using c# and mssql 2008 R2, I have a service that inserts a user into the system, users have a unique number assigned to them which is something like a1, b1 or c1 which will get increased on user insertion but before insertion I have to check whether there is any previous unique number available or not( unique numbers can be deleted on user deletion). For example if there are 5 users in the database, a1,...,a5 are reserved and if you delete lets say 3rd user then a3 will be available for next user insertion. This can be done easily but since I have to read the available unique numbers on every insertion , I'm puzzled whether it's better to use insert trigger or use application code before insertion ?</p>
  
  <p>Thanks in advance</p>