Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

SSIS OLEDB COMMAND query issue

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
zolf
Asked:
zolf
  • 3
  • 2
1 Solution
 
zolfAuthor Commented:
0
 
Anthony PerkinsCommented:
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
 
zolfAuthor Commented:
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
 
zolfAuthor Commented:
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
 
Anthony PerkinsCommented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now