Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updated Statement Error - Msg 121, Level 15, State 1

Status
Not open for further replies.

T111

Programmer
Jun 28, 2003
91
0
0
IE
Hi,
If I try a simple updated e.g.
update referrals set notes = ''

I get the following error
Msg 121, Level 15, State 1
The select list for the INSERT statement contains more items than the insert list. The number of SELECT values must match the number of INSERT columns.

If I try a similar simple update on a different table within the same database it works fine.

Any ideas appreciated.
Thanks!
 
From this message I understand that you use construction like this:
Code:
INSERT INTO SomeTable (Field list here)
SELECT (field list)
FROM ....

So your SELECT clause contains MORE fields in field list that your Field list in INSERT clause.


If you use this:
Code:
INSERT INTO SomeTable
SELECT (field list)
FROM ....
Then your SELECT clause contains MORE fields than fields you have in "SomeTable".

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
there is probably a trigger on the referrals table that is causing this problem. I suggest you look there first.


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
OOOOOOOOOOOOOOOOOOPS,
I totally missed the first part of the message.
Sorry T111.


Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
lol bborissov, though its possible this is the problem within the trigger George mentions.

Good spot George.

"I'm living so far beyond my income that we may almost be said to be living apart
 
LOL :) Yes, definitely sounds like a trigger with the problem Boris describing.
 
Yep that was it, a trigger for each update inserted all rows from deleted - "select * from deleted" and inserts into the history table. I recently added a new field and never added it to the history table, thanks guys!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top