I think you can just initialize hi_value in the hilo table with some value larger than the max ID you already have in tables using IDENTITY. Probably you'll want to have different row in the hilo table for each of the tables with IDENTITY too.
*Mohamed Meligy *Readify | Senior Developer M:+61 451 835006 | W: readify.net [image: Description: Description: Description: Description: rss_16]<http://gurustop.net> [image: Description: Description: Description: Description: cid:[email protected]] <http://www.linkedin.com/in/meligy> [image: Description: Description: Description: Description: cid:[email protected]] <http://twitter.com/meligy> <http://www.greatplacetowork.com.au/best/best-companies-australia.php><http://www.readify.net/AboutUs/NewsItem.aspx?id=10> On Thu, May 5, 2011 at 2:30 PM, Guido Tapia <[email protected]> wrote: > Hi All, > > I'm switching a simple data layer to use HILO generator (on SQL Server). > However this app has been running for a while and has been using identity > generation. So my question is, how do I do this safely? I had planned to > do something like: > - Remove all IDENTITY properties on each table manually > - Create the HILO table with the default SchemaExport like sql script, i.e: > > create table HiLoIDValues (next_hi BIGINT) > insert into HiLoIDValues values ( 1 ) > > However, how can I guarantee that I do not reuse IDs that have already been > used in the last few years?, i.e. Should I change the insert line to? > > insert into HiLoIDValues values ( (SELECT MAX ID FROM ALL TABLES) ) > > Is this necessary or does NH already do a 'SELECT MAX (IDCOLUMN)' for each > table on start up? > > Thanks in advanced. > > Guido > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
