dbTalk Databases Forums  

DTS Task and Table Structure Changes

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS Task and Table Structure Changes in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chris Clark
 
Posts: n/a

Default DTS Task and Table Structure Changes - 09-12-2003 , 04:39 AM






If someone can kick me in the right direction, that would be most helpful.

I have a DTS task (Data driven Query Task) which simply transfers data from
an Interbase database into SQL 2000 - This task works just fine.

If I modify the Destination SQL 2000 table (Add a field) and run the task, I
get the following error -

"Insert Error: Column Name or number of specified values does not match
table definition".

Clearly this must be a metadata issue of some kind, as in this instance I am
not actually doing anything with the new field. and the Insert query
specified in the task is still a valid one.

Thanks in Advance.

--


Chris Clark - Mithril Software
chris (AT) mithrilsoft (DOT) co.uk



Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: DTS Task and Table Structure Changes - 09-12-2003 , 04:50 AM






In article <3f61931e$0$246$ed9e5944 (AT) reading (DOT) news.pipex.net>, Chris Clark
<cmc (AT) uk (DOT) licom.com> writes
Quote:
If someone can kick me in the right direction, that would be most helpful.

I have a DTS task (Data driven Query Task) which simply transfers data from
an Interbase database into SQL 2000 - This task works just fine.

If I modify the Destination SQL 2000 table (Add a field) and run the task, I
get the following error -

"Insert Error: Column Name or number of specified values does not match
table definition".

Clearly this must be a metadata issue of some kind, as in this instance I am
not actually doing anything with the new field. and the Insert query
specified in the task is still a valid one.

Thanks in Advance.

Is the INSERT query still valid?

INSERT TableName (Colum1, Column2) VALUES(?, ?)

INSERT TableName VALUES(?, ?)

The top query would still be valid, since you have specified the
columns, but the bottom would break, since when you do not specify
columns, you must supply values for all columns. You can repro this
error in Query analyser, as it is pure T-SQL, don't let DTS confuse the
issue here. The other problem could be if the new column is NOT NULL,
and you don't supply a value, of course this will choke too, but the
error would be different, Something to bear in mind.


--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
  #3  
Old   
Chris Clark
 
Posts: n/a

Default Re: DTS Task and Table Structure Changes - 09-12-2003 , 05:30 AM



Quote:
Is the INSERT query still valid?

INSERT TableName (Colum1, Column2) VALUES(?, ?)

INSERT TableName VALUES(?, ?)

The top query would still be valid, since you have specified the
columns, but the bottom would break, since when you do not specify
columns, you must supply values for all columns. You can repro this
error in Query analyser, as it is pure T-SQL, don't let DTS confuse the
issue here. The other problem could be if the new column is NOT NULL,
and you don't supply a value, of course this will choke too, but the
error would be different, Something to bear in mind.

Thanks Darren.

This is the way I follow it too, and why I'm having trouble identifying
where the issue is.

The insert quesry is specified as

INSERT
INTO Sal_Transactions(Category, Tran_Amount, Sold_By, Tran_Date)
VALUES (?, ?, ?, ?)

So in theory if I add an extra field to the destination table this query
should still work....?


Chris




Reply With Quote
  #4  
Old   
Chris Clark
 
Posts: n/a

Default Re: DTS Task and Table Structure Changes - 09-12-2003 , 05:45 AM



Quote:
The insert quesry is specified as

INSERT
INTO Sal_Transactions(Category, Tran_Amount, Sold_By, Tran_Date)
VALUES (?, ?, ?, ?)

So in theory if I add an extra field to the destination table this query
should still work....?

Sorry - I'm an idiot.

I have an instead of insert trigger on the table which is formed just with
values.

While the above insert is totally correct, the Insert in the trigger needs
to be modified to account for all fields. The DTS error message obfuscated
the source of the error, I actually took your suggestion of running it in
Query Analyzer (Thanks - should have done this to start with) and the source
of the error (The Trigger) was aparent.

A Nice little lesson Learnt there....

Chris.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.