Solved

SSIS OLEDB COMMAND query issue

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In couple weeks ago, I encountered an extremely difficult problem while deploying 2008 SSIS packages to a new environment (SQL Server 2014 standard).  My scenario is: We have one C# application that is calling 2008R2 SSIS packages to load text fi…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.

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

16 Experts available now in Live!

Get 1:1 Help Now