Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Insert

Author  Topic 

dbalearner
Constraint Violating Yak Guru

272 Posts

Posted - 2012-08-26 : 21:37:41
Couldn't find any evidence why it is not inserting the record.

Msg 213, Level 16, State 1, Line 1
Column name or number of supplied values does not match table definition.


Many Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-26 : 21:49:45
its obvious. you're not passing values as per table definition. either one of columns is missing a value in values list or column itself is missing in columns list

to be safe use syntax like INSERT Tablename(col1,col2,col3...) VALUES (value1,value2,value3,...)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

dbalearner
Constraint Violating Yak Guru

272 Posts

Posted - 2012-08-27 : 18:12:47
I have followed the same suggested instead still giving the same error.

Already the Same table Structure has been copied out and created with different name and tried to insert but couldn't find the matching !

Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2012-08-27 : 18:38:51
Post the Schema and Insert Statement.

-Chad
Go to Top of Page

dbalearner
Constraint Violating Yak Guru

272 Posts

Posted - 2012-08-28 : 21:11:26
The Schema is same as of other table.

Trying to Insert into Same structure table as CART_TAB from one database to another.

insert into [dc-sql-01].[I14_CorruptTreat].dbo.cart_tab
Select * from CART_Tab
where ridquotient ='000000700097'
and uidMaster = '0001096487:01010:00071'
and service ='TREK'
and Deleted =0
order by RecordNums

The columns above were on referential integrity and other columns were allowed.

till Otherday could able to insert but all of sudden it is now with the error.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-28 : 21:50:49
quote:
Originally posted by dbalearner

The Schema is same as of other table.

Trying to Insert into Same structure table as CART_TAB from one database to another.

insert into [dc-sql-01].[I14_CorruptTreat].dbo.cart_tab
Select * from CART_Tab
where ridquotient ='000000700097'
and uidMaster = '0001096487:01010:00071'
and service ='TREK'
and Deleted =0
order by RecordNums

The columns above were on referential integrity and other columns were allowed.

till Otherday could able to insert but all of sudden it is now with the error.


replace * on the select with actual columns

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -