Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:01:15+00:00 2026-06-09T06:01:15+00:00

Playing around with SQL Server 2008 and I have a table People with columns:

  • 0

Playing around with SQL Server 2008 and I have a table People with columns:

Name  | City |  Born | ...

and another table Change with columns:

OldName  |  NewName

Now I would like to change Name in the table People something like this: if there is the same OldName in table Change as the Name in People then change the Name in People to the NewName in Change.

Any easy way?

Oh and another question to this: if the Name in People would be the primary key (or let say Name and City would be composite key), would it be much harder to change the name? Thx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:01:16+00:00Added an answer on June 9, 2026 at 6:01 am

    Answer1)

    UPDATE people,change
    SET people.name = change.newname
    WHERE people.name = change.oldName
    

    EDIT with inner Join syntax:

    UPDATE people
    SET people.name = change.newName
    FROM people
    INNER JOIN change ON people.name = change.oldName
    

    I don’t have a SQL Server to test that on, but based on online examples, it should work.

    /Edit

    Answer2) As long as you still maintain uniqueness in the key it wouldn’t be difficult to change at all. As soon as you cause a collision you would get an error. For this reason it would be best to have an auto-incrementing ID field in people that would be your PK

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have other people here played with SQL Server 2008 Compression at either the page
I have been playing around with a quite complex SQL Statement for a few
I'm interested in playing around with the EAV model over an SQL Server Database.
I'm new at PHP and SQL, so I was playing around with this table
I'm playing around and learning to use Microsoft SQL Server. I want to store
We have SQL Server 2008 R2 running in compatibility mode 80 (2000) as we
Just playing around with subqueries in SQL Server (I know that this problem doesn't
I've been playing around with LINQ to SQL and I just have a couple
I've been playing around with a few SQL queries trying to get the column
I have an asp.net-mvc3 website using nhibernate and SQL server. I have 2 web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.