Solved

SQL 2008 Linked Table UPDATE with INNER JOIN syntax help.

Posted on 2010-09-23
1
532 Views
Last Modified: 2012-05-10
Hello Group;
I am trying to update a Linked Server table with the following query but have varying errors.
Please let me know what the heck I am doing wrong here.  Because it is a linked server, the tables initially need to be called out in Four Dot notation.

UPDATE [VANTAGE TEST].[MFGSYS].[PUB].[PartPlant]
SET DaysOfSupply = 10
FROM(SELECT DaysOfSupply FROM [VANTAGE TEST].[MFGSYS].[PUB].[PartPlant]
INNER JOIN [VANTAGE TEST].[MFGSYS].[PUB].[Part]
ON PartPlant.PartNum = Part.PartNum WHERE Part.TypeCode ="P")

Goal: Update the PartPlant.DaysOfSupply with a value of 10.  I get errors like Cannot update VarChar field with Integer, but when I try to put the value of 10 in quotes I get other errors.

Thanks for any help!
GLH
0
Comment
Question by:PCI-INTL
1 Comment
 

Accepted Solution

by:
PCI-INTL earned 0 total points
ID: 33749714
Got it!  Just had to change the "ON" portion reverse the table names and use single quotes.

UPDATE [VANTAGE TEST].[MFGSYS].[PUB].[PartPlant]
SET DaysOfSupply = 14
SELECT DaysOfSupply FROM [VANTAGE TEST].[MFGSYS].[PUB].[PartPlant]
INNER JOIN [VANTAGE TEST].[MFGSYS].[PUB].[Part]
ON Part.PartNum = PartPlant.PartNum WHERE Part.TypeCode = 'P'
GO
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

13 Experts available now in Live!

Get 1:1 Help Now