Welcome to weblogs.com.pk Sign in | Join | Help

Unique Identity Across Multiple Tables

This week had been a busy one; we had three deliverables; one internal app and two clients app. Due to training sessions; things get screwed up; it got hard to find the time…I was checking my timesheets; and wow! I have given about 50% extra time to the office this week <geez/>

One of these three was solely my baby, I am lucky that it was ASP.NET v2 app; and you guys will not believe that I made it in just four sessions of about 2/3 hours each; it was quite a bulky one; a complete administrative console of the system. Thanks to SqlDataSource, DataBinding and Visual Studio.NET designer; it saved many hours. The interesting stuff is that for this whole app; I had two write very few lines of code; I guess its not more than 500; all the remaining stuff was generated by the VS.NET. I am not proud of what I have done; but who cares? As long as it’s working!

Update: The app was a web interface above the data tier being accessed using stored procedures; I must say that the real magic is in stored procedures and that heavy lifting was already done before!

Just a small tip for my readers / colleagues. If you happen to have a scenario where there are multiple base tables of a given view; and multiple tables of the views are “hot” (i-e new data can be inserted) and you want to have an identity key that remains unique across multiple “hot” tables; the simplest thing you can do is to set increments of identity values in base tables; e-g if there are two tables; you can have +2 value for increment in each table; add one entry manually into one table before setting the increment; this way one table will have even values in identity field and the other will have odd values. You can now extend this idea across as many tables as you like!

Happy weekend!

Published Friday, June 16, 2006 8:24 PM by khurram
Filed under:


# re: Unique Identity Across Multiple Tables

Saturday, June 17, 2006 11:34 AM by Adnan Siddiqi
hmmmmm ,i never noticed that or i say never understood that.Is it similar to SEQUENCE generation in Oracle?

# re: Unique Identity Across Multiple Tables

Sunday, June 18, 2006 1:14 AM by khurram
More or less its same...

Oracle's Sequence is more powerful comparing to SQL's Identity field concepts!
New Comments to this post are disabled