January 20, 2010 at 9:39 am
how to load data whch has computed column in a table , as a result i get this error
Msg 213, Level 16, State 1, Line 2
Insert Error: Column name or number of supplied values does not match table definition.
January 20, 2010 at 9:55 am
you cannot include the computed column name in any insert/update/delete statement;
so if you were doing something like
INSERT INTO SOMETABLE(PK,Value,computedvalue)
SELECT 1,3.1415,2*(3.1415)^2
--it must be changed to
INSERT INTO SOMETABLE(PK,Value)
SELECT 1,3.1415
Lowell
January 20, 2010 at 10:17 am
I dont provide the colums names when i do the insert .
when i provide the column names , i should not give the computed column name right
is that what you mean
January 20, 2010 at 10:26 am
if a calculated column exists in the table, you MUST supply the column names.
insert into mytable
select 1,2,3,4 --will no longer work.
you must say
insert into mytable(col1,col2,col3,col4)
select 1,2,3,4
show us the insert statement...
Lowell
January 20, 2010 at 10:33 am
insert into dbo.Billing
select * from [112.64.104.210,3824 ].fttpreports.dbo.Billing
January 20, 2010 at 10:40 am
nikki123 (1/20/2010)
insert into dbo.Billingselect * from [112.64.104.210,3824 ].fttpreports.dbo.Billing
Check your table DDL. The error tells you exactly what to look at.....number of columns (including order) and data types.
Your best bet is to list out the columns in your INSERT....SELECT statement.
INSERT INTO TableName(Col1, Col2, Col3, ...ColN)
SELECT Col1, Col2, Col3, ...ColN
FROM SourceTable
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply