Update table

Posted on 2007-08-07
Medium Priority
Last Modified: 2013-11-05
I have a table DimCounty(CountyID,CountyDescr).This has 3000 distinct rows
CountyID    CountyDescr
1           Abbeville
2           Acadia
3           Adair

Another Table CountyStatusFACT(CountyID,CountyDescr,StatusID,Projcount).
This is as follows:
CountyID    CountyDescr   StatusID    Projcount
1           Abbeville       100         2
1           Abbeville       200         10
2           Acadia          200         24

I want to update CountyStatusFACT where CountyID is updated with the values of CountyID as in table DimCounty.
So we get the result as shown above.

Question by:sbagireddi
1 Comment
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 2000 total points
ID: 19649557
Update CountyStatusFACT
  set CountyID = c.CountyID
FROM CountyStatusFACT f
JOIN dimcounty c
 on c.CountyDescr = f.CountyDescr

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question