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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:34:05+00:00 2026-05-24T13:34:05+00:00

Lets say I have two tables, Tool and IOPoint, both with GUID as the

  • 0

Lets say I have two tables, Tool and IOPoint, both with GUID as the PK. Tool has a column that is a GUID FK column to the IOPoint table.

When I change the IOPoint in the program, I don’t want to update the value, but instead update the FK from the list of entries in IOPoint (IOPoint table is non-changing).

Therefore, I have to do a SELECT from IOPoint based on 2 unique columns and update THAT row’s GUID into the Tool table’s FK column.

VAR myGUID = SELECT IOP.ID 
    FROM IOPoint IOP
    WHERE IOP.A = @A AND IOP.B=@B

UPDATE Tool T
    SET T.IOPoint_1 = myGuid
    WHERE T.ID=@ID

I have to do this query about 30 times per db update due to the large number of IOPoints used in the program, so I need to find the most efficient way of doing it that will hopefully not cause performance issues.

Any help is appreciated. Thanks everyone!

  • 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-05-24T13:34:06+00:00Added an answer on May 24, 2026 at 1:34 pm

    I think you can do the SELECT and UPDATE in a single SQL statement a shown below.

    Assuming the tables are under dbo schema, the query joins the tables dbo.Tool and dbo.IOPoint using the key column ID and filters the rows by columns A and B. Then, it updates the ID value from table IOPoint to the IOPoint_1 column in table Tool.

    I hope that is what you are looking for.

    UPDATE      T
    SET         T.IOPoint_1 = IOP.ID
    FROM        dbo.Tool    T
    INNER JOIN  dbo.IOPoint IOP
    ON          IOP.ID      = T.ID
    WHERE       IOP.A       = @A
    AND         IOP.B       = @B
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables. Lets say they look like this Table Sports: Column 1:
Lets say I have two tables: table english which has two columns, id and
Lets say that I have two tables. Table 1 is a list of vendors
Lets say that I have two tables. The first is: table lists, with list_id
I have two tables lets say employees and order, both table have millions of
Lets say I have two tables - Cat and Cat owner that are linked
Lets say i have two tables EMPLOYEE and INCHARGE_ROOM , EMPLOYEE.INCHARGE_ROOMS has | delimted
Lets say I have two tables, one for transactions, and another table who's primary
Lets say I have a simple many-to-many table between tables table1 and table2 that
Lets say I have two tables in Postgres: Name: table_rad Column Type id integer

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.