Solved

SSIS OLEDB COMMAND query issue

Posted on 2014-07-26
6
294 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

860 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