I think the question is very good as well, but I am not sure if the answer is correct.
Error: "Column name or number of supplied values does not match table definition."
for the following reason:
It may not be defined into which table the data is inserted, but the error seems to be raised all the time.
CREATE TABLE #Tables (tablename sysname, rowcnt int, nullable varchar)
CREATE PROCEDURE #Proc
CREATE TABLE #t (a int NOT NULL )
INSERT #t SELECT 1 UNION SELECT 2 -- Insert two rows
-- Check which tables we inserted rows into
INSERT #Tables SELECT O.name, P.row_count, (SELECT is_nullable FROM sys.columns WHERE name = 'a' AND object_id = O.object_id) from sys.objects O, sys.dm_db_partition_stats P WHERE O.name LIKE '#t\_%' ESCAPE ('\') AND O.object_id = P.object_id
CREATE TABLE #t (a int NULL)
INSERT #t SELECT 1 -- Insert one row
SELECT * FROM #Tables
DROP TABLE #t
DROP TABLE #Tables
DROP PROCEDURE #Proc
In the above code example, you will see that most of the time, 1 row is inserted into the table with the nullable column, and two rows into the other one. Occationally you see that the two are exchanged and this is the "not defined" portion.
If you exchange the two insert statements, the above rules are also switched (most of the time 2 rows are inserted into the nullable collumn and only some times vice versa).
Now to the error portion. If you add another column (e.g. b sysname) to one of the CREATE TABLE statements, you will get the column list error message. This error is raised all the time, and also when you switch the table to which you add this extra column. To me this is a strong indication that this error is not "undefined".
Pls let me know your thoughts