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 8152555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:44:49+00:00 2026-06-06T15:44:49+00:00

I have one SQL server database which was created using Import/Export Wizard from an

  • 0

I have one SQL server database which was created using Import/Export Wizard from an Access Database. I then have another SQL database which is based upon the Access database but has a slightly different schema. I am trying to get the data from the simple Access based database into the more complex SQL server schema database. The Access database simply stored the Country as text in Contact table and in my new schema the Contact table has a CountryId which links to the Country table. I’ve tried to write the SQL to do this:

UDPATE SQLVersion.dbo.Contact
SET CountryId = (SELECT LookupCountry.Id
                 FROM SQLVersion.dbo.Country as LookupCountry, AccessDBVersion.dbo.tblContact as AccessContact
                 WHERE LookupCountry.Name = AccessContact.Country);

This doesn’t work because:

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

I can understand why this error is thrown but I don’t know how to form the correct SQL that will allow it to update each row with the value found from the lookup. Can anyone help please?

  • 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-06T15:44:50+00:00Added an answer on June 6, 2026 at 3:44 pm

    Looks like you’re missing the relation between Contact and tblContact. Assuming those are linked by name, you can rewrite the query in a clearer way like:

    update  c
    set     countryId = lc.Id
    from    SQLVersion.dbo.Contact c
    join    AccessDBVersion.dbo.tblContact ac
    on      ac.Name = c.Name
    join    SQLVersion.dbo.Country lc
    on      lc.Name = ac.Country
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGridView which is filling from Table in SQL Server Database. One
I have created one user named tuser with create database rights in SQL server
I have strange scenario in which if I create database using SQL Server 2008
I have one field in Database ( Sql Server DB 2000) with varchar field
I have a database in SQL Server 2008 and one particular table has information
I have an existing SQL Server database, where I store data from large specific
First a little introduction. We have an SQL Server Express 2008 database, which schema
I have the below SQL Script which is run from Excel VBA using ADO
I have a java.sql.Clob object which I populate from an Oracle query and then
Using C# (vs2005) I need to copy a table from one database to another.

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.