|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi
To make it more clear, i am explaining my problem in detail. I am using two databases.One for online processing. Another database for offline processing. If new records are added in online database tables, then it should be added in offline database tables also and vice versa. Suppose if a new user is added in USERS table in online database and userID 100 is assigned to that user.Similarly in Offline processing also, another different user is being assigned the same UserID 100. If i want to download/upload the database changes, there arises the primary key conflict, where in both databases there is a record with UserID as 100 and it is not possible to reassign userID. how to solve this problem ?? |
|
#2
|
|||
|
|||
|
Well, you need to make sure that userID is never the same in the 2 tables. Im guessing you have identity ON
One way to do this is to change the identity seed and increment. Example: In the first table USERS, set the seed = 1 and increment = 2 so the userID would be odds only (1, 3, 5, 7....) In the second table USERS set the seed = 2 and increment = 2 (2, 4, 6, 8....) for evens One odd and one even and increment by 2 no matter what seed you start at. I Hope this helps. |
|
#3
|
|||
|
|||
|
I didn't think about that, this is a much better solution than the one I was going for in the other thread.
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Primary Key Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|