Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Three tables with common id

Author  Topic 

bjkalley
Starting Member

2 Posts

Posted - 2009-04-25 : 05:12:07
Hi,

I'm using MS SQL 2005. There are three tables that I don't want them to have common ids. For instance I add a record to table1 and the last record id becomes 10, and then I add another record to table2 this time. The last record's id at table2 was 9. So if the new record's id become 10, it will be same with the table1's. I want them to be different, no common id should be at different tables. I can do it with writing a code, and disabling the auto increament of id's but code will check all the table's last id's and have much more processing cost to CPU. Is there any way to bound them?

Thanks

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-04-25 : 05:29:56
Set Different seed for tables in identity column(auto increment)


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page

bjkalley
Starting Member

2 Posts

Posted - 2009-04-25 : 05:47:49
When I set 3 seed for one, 5 seed for another they will meet at 15 :)
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-04-25 : 09:47:36
Create a table to manage your different ids.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -