On Sun, Sep 6, 2009 at 1:30 PM, Nick Causton<[email protected]> wrote: > Any thoughts on the best way to generate a unique Id for records in a daily > log table. I would like to try and be efficient if possible and fit this > into an Integer field. These log tables would probably be free tables not > part of a database. > > I firstly looked at having 8 bytes for the date + 8 bytes for the > milliseconds past midnight but that gives me a value 16 digits long, much > longer than the 10 digits of an Integer field. > > Also considered SYS(3) or SYS(20015) but don't know if either of them can be > relied on to be completely unique. In this case the app is triggered as a > COM object by incoming email in Exchange, I can't guarantee that there will > never be two instances running at the same time. > > Next idea is an Auto-incrementing Integer field but starting from a > different base each day, say two bytes binary for the day and two for the > counter. Problem here might be if there was ever a fault and a second log > file for the same day was created. > > What do you suggest is the best way to deal with this? ---------------------------
Do you want to see real data as part of your id? When, by whom? -- Stephen Russell Sr. Production Systems Programmer SQL Server DBA Web and Winform Development Independent Contractor Memphis TN 901.246-0159 _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

