MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 24th, 2004, 05:34 AM
uma_g uma_g is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 42 uma_g User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 37 m 7 sec
Reputation Power: 4
Primary Key Problem

hi

I am using two same databases, db1,db2. db1 in offline.db2 in online.In db1, one record is inserted with id as 10. similarly, in db2 ,another different record is inserted with id as 10.how to synchronise this two tables ?

??? Uma

Reply With Quote
  #2  
Old December 28th, 2004, 05:05 PM
Aforsythe Aforsythe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 104 Aforsythe User rank is Private First Class (20 - 50 Reputation Level)Aforsythe User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 22 h 8 m 10 sec
Reputation Power: 4
Is the primary key set as an identity column?

Are there other tables that reference the primary key in this table?

Reply With Quote
  #3  
Old December 28th, 2004, 10:44 PM
uma_g uma_g is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 42 uma_g User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 37 m 7 sec
Reputation Power: 4
Primary key Problem

Quote:
Originally Posted by Aforsythe
Is the primary key set as an identity column?

Are there other tables that reference the primary key in this table?


hi
Thanks for ur help!!!

Yes, primary key set as an identity column. 4 - 5 tables are referring this table.

In DB1 (Offline Processing), in table USERS - >new record is added & userid is generated as 51.

In DB2(online Processing), in table USERS - >new record is added & userid is generated as 51.

Both Processing are independent.If admin wants to Upload/Download the changes in both the databases, this primary key conflict arises.

B'coz in both tables (table name : USERS),a record with userId as 51 exists and userId should not be changed.

My requirement is after upload/download function, both databases should be same (synchronising both the databases)
Is there any other solution to solve this problem??

Thanks
uma

Reply With Quote
  #4  
Old December 30th, 2004, 12:06 PM
Aforsythe Aforsythe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 104 Aforsythe User rank is Private First Class (20 - 50 Reputation Level)Aforsythe User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 22 h 8 m 10 sec
Reputation Power: 4
Not without changing the user id's in one table or the other. It has to change somewhere. Also, is modifying the tables and possibly the application using the tables an option?

The only other option would be to change the primary key to username or something along those lines and lose the identity property on the userid column.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Primary Key Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT