Update table

Posted on 2007-08-07
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 142

    Accepted Solution

    Update CountyStatusFACT
      set CountyID = c.CountyID
    FROM CountyStatusFACT f
    JOIN dimcounty c
     on c.CountyDescr = f.CountyDescr

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
    Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now