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

  • Home
  • SEARCH
  • 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 6116229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:10:57+00:00 2026-05-23T15:10:57+00:00

I wanna update remote table with following code but I encounter this error: `Msg

  • 0

I wanna update remote table with following code but I encounter this error:

`Msg 208, Level 16, State 1, Line 12
Invalid object name 'f1'.`

code:

declare @temp table
    (
      co_kargah bigint,
      code_ostan nvarchar(10)
    )
    insert into @temp 
          select co_kargah,code_ostan
                from Tbl_ghireHadese_Temp
                where InsUpKey=2

                update  f1  /* Error location*/
                set

                f1.modate_mogharar=tbl_ghireHadese.modate_mogharar,
                f1.t_pm_mogharar=tbl_ghireHadese.t_pm_mogharar

    from openquery([lnkworkersystem],'select * from Bazresi_Kar.dbo.Tbl_ghireHadese') f1
                inner join @temp temp
                 on temp.co_kargah=f1.co_kargah
                   and temp.code_ostan=f1.code_ostan
                   and temp.t_bazresiFE=f1.t_bazresiFE
                inner join tbl_ghireHadese
                     on temp.co_kargah=tbl_ghireHadese.co_kargah
                        and temp.code_ostan=tbl_ghireHadese.code_ostan
                        and temp.t_bazresiFE=tbl_ghireHadese.t_bazresiFE
  • 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-23T15:10:58+00:00Added an answer on May 23, 2026 at 3:10 pm

    The error is in the SET clause. You can’t specify aliases in the column assign. There is no need because you’ve already told SQL Server what table in the UPDATE clause

    Should be:

    update  f1 
    set
       modate_mogharar = tbl_ghireHadese.modate_mogharar,
       t_pm_mogharar = tbl_ghireHadese.t_pm_mogharar
    from 
    ....
    

    Note: SQL Server doesn’t always give the correct line number for errors

    Edit: use 4 part object names as normal tables

    ...
    
    FROM
        lnkworkersystem.Bazresi_Kar.dbo.Tbl_ghireHadese
        inner join
        @temp temp on temp.co_kargah=f1.co_kargah
        ...
    

    Also, your temp table has 3 columns in the JOIN but is only defined with 2. t_bazresiFE is missing. So it will error again…

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

Sidebar

Related Questions

I wanna update first and last name of one table with incremental value. For
I wanna make use of the Ternary Operator with an object. if($msg == 'hello'){
I wanna rewrite links like index.php?page=entry&id=15&action=edit to entry/15/edit . This is how my .htaccess
I wanna verify a digitally signed xml against its schema definition while this schema
i have a table like this one: id | name | score mapped to
I wanna do some local developer tests of IIS 7 but I don't have
I wanna to have query: Select cars.* from cars where cars.code in ( select
I wanna use temporary table to avoid field names enumeration inside SELECT clause. And
I have a query that takes 2minutes to count from table A and update
I know there are more threads about this but they dont help me and

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.