Solved

SSIS OLEDB COMMAND query issue

Posted on 2014-07-26
6
290 Views
Last Modified: 2016-02-11
Hello there,

I am trying to run this query in the SSIS OLEDB COMMAND but for some reason I get this error(see shot)

update district set district.districtname=? 
from district inner join city on district.id=city.districtid 
where city.fdocode=? and city.taxcode=?

Open in new window

0
Comment
Question by:zolf
  • 3
  • 2
6 Comments
 

Author Comment

by:zolf
ID: 40222223
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40222598
Post the schema for your two tables, it would appear that the city table does not contain the columns fdocode and taxcode in the specific database in your connection.

P.S. And Jim is right I nearly gave up looking for the error message.  Next time just copy and paste the text here.
0
 

Author Comment

by:zolf
ID: 40223396
Jim - I will follow the instruction henceforth.

Anthony -

Here is the schema

CREATE TABLE
    district
    (
        id BIGINT NOT NULL,
        districtname NVARCHAR(255) COLLATE Latin1_General_CI_AS,
        countyID BIGINT,
        PRIMARY KEY (id),

Open in new window


CREATE TABLE
    district
    (
        id BIGINT NOT NULL,
        districtname NVARCHAR(255) COLLATE Latin1_General_CI_AS,
        countyID BIGINT,
        PRIMARY KEY (id),

Open in new window

0
 

Author Comment

by:zolf
ID: 40223474
One point to note is that in my OLE DB SOURCE I have a JOIN query which looks like this

SELECT
    dbo.province.id,
    dbo.province.provincename,
    dbo.province.code,
    dbo.county.id,
    dbo.county.provinceID,
    dbo.county.countyname,
    dbo.district.id,
    dbo.district.districtname,
    dbo.district.countyID,
    dbo.city.id,
    dbo.city.districtID,
    dbo.city.cityname,
    dbo.city.telcode,
    dbo.city.taxcode,
    dbo.city.fdocode
FROM
    dbo.county
INNER JOIN
    dbo.province
ON
    (
        dbo.county.provinceID = dbo.province.id)
INNER JOIN
    dbo.district
ON
    (
        dbo.county.id = dbo.district.countyID)
INNER JOIN
    dbo.city
ON
    (
        dbo.district.id = dbo.city.districtID) ;

Open in new window

0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 total points
ID: 40225875
You posted the same schema twice.  

The select query you have just posted can be rewritten a little more clearer as follows
SELECT  p.id,
        p.provincename,
        p.code,
        c.id,
        c.provinceID,
        c.countyname,
        d.id,
        d.districtname,
        d.countyID,
        t.id,
        t.districtID,
        t.cityname,
        t.telcode,
        t.taxcode,
        t.fdocode
FROM    dbo.county c
        INNER JOIN dbo.province p ON c.provinceID = p.id
        INNER JOIN dbo.district d ON c.id = d.countyID
        INNER JOIN dbo.city t ON d.id = t.districtID;

Open in new window


Have you tried executing that UPDATE statement in SSMS, using the appropriate values instead of the parameters you use in SSIS?
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
A couple of weeks ago, my client requested me to implement a SSIS package that allows them to download their files from a FTP server and archives them. Microsoft SSIS is the powerful tool which allows us to proceed multiple files at same time even w…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

932 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

10 Experts available now in Live!

Get 1:1 Help Now