Solved

SSIS OLEDB COMMAND query issue

Posted on 2014-07-26
6
298 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

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…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

617 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