sqlsql-serversql-server-2005t-sql

Column name or number of supplied values does not match table definition


In the SQL Server, I am trying to insert values from one table to another by using the below query:

delete from tblTable1

insert into tblTable1 select * from tblTable1_Link

I am getting the following error:

Column name or number of supplied values does not match table definition.

I am sure that both the tables have the same structure, same column names and same data types.


Solution

  • They don't have the same structure... I can guarantee they are different

    I know you've already created it... There is already an object named ‘tbltable1’ in the database

    What you may want is this (which also fixes your other issue):

    Drop table tblTable1
    
    select * into tblTable1 from tblTable1_Link