Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to update data in a table having primary key - foreign key link with another table Expand / Collapse
Author
Message
Posted Monday, July 29, 2013 7:27 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Tuesday, December 23, 2014 4:47 AM
Points: 584, Visits: 1,858
Hello,

Could someone please tell how can data be updated (refreshed) in one table if the data is refreshed on another table and both tables are linked through a primary key - foreign key ?

I just need to know what logic I need to apply to update the values in a table if the same value has been refreshed in another table.

Thanks.
Post #1478580
Posted Monday, July 29, 2013 7:32 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Tuesday, December 23, 2014 12:10 PM
Points: 13,330, Visits: 12,829
pwalter83 (7/29/2013)
Hello,

Could someone please tell how can data be updated (refreshed) in one table if the data is refreshed on another table and both tables are linked through a primary key - foreign key ?

I just need to know what logic I need to apply to update the values in a table if the same value has been refreshed in another table.

Thanks.


Without any more details about this I doubt anybody has much to offer. I think that what you are saying is that you have tablea and tableb. There is some column in tableb that is a foreign key to a column in tablea? Can you cascade updates and deletes on the foreign key? Or is your question because the update has already happened and now you want to fix the data in tableb?


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1478585
Posted Monday, July 29, 2013 7:43 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, December 18, 2014 1:43 AM
Points: 6,890, Visits: 14,254
Sean, there are more details here.

“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1478590
Posted Monday, July 29, 2013 7:52 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Tuesday, December 23, 2014 12:10 PM
Points: 13,330, Visits: 12,829
ChrisM@Work (7/29/2013)
Sean, there are more details here.


I don't know that I would call that details but that certainly shows this is a duplicate thread.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1478594
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse