loading data

  • 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.

  • 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


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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

  • 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


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • insert into dbo.Billing

    select * from [112.64.104.210,3824 ].fttpreports.dbo.Billing

  • nikki123 (1/20/2010)


    insert into dbo.Billing

    select * 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

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply