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 2005 Forums
 Transact-SQL (2005)
 SELECT INTO Error

Author  Topic 

Mallen
Starting Member

27 Posts

Posted - 2010-10-13 : 11:15:10
This is probably something obvious I am missing but I am getting the error "Insert Error: Column name or number of supplied values does not match table definition"
For the life of me it looks like everything matches. Here is the code:

CREATE TABLE Five9CSV
(LRCS varchar (50),
DNIS varchar (50),
[DateTime] varchar (50),
Disposition varchar (50),
Comment varchar(250),
Agent varchar(50));

INSERT INTO FIVE9CSV
SELECT
f.LRCS,
f.DNIS,
(f.Date + f.Time),
f.Disposition,
f.Comment,
f.Agent
FROM @Five9CSV f;


Am I doing something wrong with the temp table? With combining two fields into one? Any help is appreciated.

Thanks.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-10-13 : 11:20:14
execute the select part only and see what happens.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

SD_Monkey
Starting Member

38 Posts

Posted - 2010-10-13 : 11:49:05
i think your concatanition is having some error..

convert first into varchar

A maze make you much more better
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-10-13 : 12:16:59
not this is your problem

BUT

You should definetly list out the columns in your INSERT Statement

we probable need the DDL for the table variable as well...and sample data

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx





Go to Top of Page

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-10-13 : 12:28:03
quote:
Originally posted by Mallen

This is probably something obvious I am missing but I am getting the error "Insert Error: Column name or number of supplied values does not match table definition"
For the life of me it looks like everything matches. Here is the code:

CREATE TABLE Five9CSV
(LRCS varchar (50),
DNIS varchar (50),
[DateTime] varchar (50),
Disposition varchar (50),
Comment varchar(250),
Agent varchar(50));

INSERT INTO FIVE9CSV
SELECT
f.LRCS,
f.DNIS,
(f.Date + f.Time),
f.Disposition,
f.Comment,
f.Agent
FROM @Five9CSV f;


Am I doing something wrong with the temp table? With combining two fields into one? Any help is appreciated.

Thanks.



Can you please post the complete code because code used for creating table variable (@Five9CSV) and inserts into that table is not posted.
Go to Top of Page

Mallen
Starting Member

27 Posts

Posted - 2010-10-13 : 12:38:36
Well I ended up just making @Five9CSV and real table instead of a temp table and inserting it into a new table named Five9Exp. Exact same code only with no temp tables and everything is running fine.

Now I am running into a problem with my date and time though which I guess I will post in a new thread >.<

Thank you.
Go to Top of Page
   

- Advertisement -