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.
| Author |
Topic |
|
majnoon
Starting Member
26 Posts |
Posted - 2004-04-27 : 10:05:48
|
| Hi:I have 2 databases on the same server. Both databases hold product information each for a particular vendor. The 2 sets of information need to be kept apart for security reasons.The main table (ProductList) uses an Auto-Incremental field to uniquely identify each record. Among various other things the databases will be feeding a database driven web-site and uses the auto-incremental value to return product informationIs there a way to maintain the uniqueness of the auto-increment field across both databasesThanks in advance of your helpWishing you a peaceful journey |
|
|
samsekar
Constraint Violating Yak Guru
437 Posts |
Posted - 2004-04-27 : 10:19:28
|
| Yes, SAY, Set db1.dbo.tableA identity seed as 1 and Set db2.dbo.tableB identity seed as 2000000. But you have to be careful on deciding the seed for the tableB, the records on the tableA should not be more than or equal to 2000000. So, first analyse the max number of data on TableA.- Sekar |
 |
|
|
samsekar
Constraint Violating Yak Guru
437 Posts |
Posted - 2004-04-27 : 10:21:53
|
| Also, Read BOL on topic "Globally Unique Identifiers"HTH..- Sekar |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-04-27 : 10:31:06
|
| Two options:1. Set up one table in one of the databases that just has an identity column. Create a unique index on both tables, get rid of the identity column, and just use an INT datatype. You can then get the value from the one table. We've been unfortunate enough to have to do that here.2. Use a GUID. Then you don't have to worry about it. Unfortunately it's slower to lookup and you can't exactly display it as a loan_id for example in an application. (That would make some users happy.)MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|