| Author |
Topic |
|
Tigger
Yak Posting Veteran
85 Posts |
Posted - 2003-02-04 : 15:51:44
|
Can anybody see what is wrong with this?INSERT INTO TABLE1 ( FIELD1, FIELD2, FIELD3, FIELD4, FIELD5, FIELD6, FIELD7, FIELD8, FIELD9, FIELD10, FIELD11, FIELD12, FIELD13, FIELD14 )SELECT field1, -- FIELD1, field2, -- FIELD2, field3, -- FIELD3, field4, -- FIELD4, field5, -- FIELD5, field6, -- FIELD6, field7, -- FIELD7 field8, -- FIELD8, field9, -- FIELD9, field10, -- FIELD10, field11, -- FIELD11, field12, -- FIELD12, field13, -- FIELD13, field14 -- FIELD14FROM TABLE2I keep getting an error message saying"Server: Msg 120, Level 15, State 1, Line 33The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns."But unless I am going completely mad (which wouldn't surprise me !! ) the number of select values DOES match the number of insert columns -- AAAARRRGGHH!!! I've been staring at this for over an hournow and can't see what's wrong ........ |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-02-04 : 15:54:43
|
| I see nothing wrong with it at all. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-02-04 : 16:08:54
|
| Looks ok, try getting rid of the comments...also make sure you're only executing that code by highlughting it...don't know what else it could be.Good LuckBrett8-) |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-02-04 : 16:11:22
|
| Are you sure it's this statement?Try retyping it without comments to check if there are no invalid characters around.Check if there is an insert trigger on the table which is causing the error.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-02-04 : 16:26:03
|
| I'm at a loss...cut and paste this, highlight in a query analyzer window, and execute...let us know what happensThanksBrett8-)INSERT INTO TABLE1 (FIELD1,FIELD2 ,FIELD3,FIELD4,FIELD5 ,FIELD6,FIELD7,FIELD8 ,FIELD9,FIELD10,FIELD11 ,FIELD12,FIELD13,FIELD14) SELECT field1,field2,field3,field4,field5,field6,field7,field8,field9,field10,field11,field12,field13,field14FROM TABLE2 |
 |
|
|
Tigger
Yak Posting Veteran
85 Posts |
Posted - 2003-02-04 : 16:36:38
|
Thanks for the help guys - good to see I'm not going mad!Found the problem - or should I say fixed the problem as I still don'tknow what it's problem was ! There must be some kind of hidden, invalid character on the SELECT line for field5 - by retyping that line its now all okay ... should have thought to check for invisible characters!! It's no wonder I'm going grey !! |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2003-02-06 : 04:20:51
|
| mmmm......I came across that problem a long time ago....(once and once only)as usual, when all else fails.....start back at the very beginning. |
 |
|
|
kadrove
Starting Member
13 Posts |
Posted - 2003-02-28 : 18:01:10
|
| When this happens to me it is usually caused by a missed comma in one of the lists. |
 |
|
|
|
|
|