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 2000 Forums
 SQL Server Development (2000)
 Question - Dynamic Cross-Tabs/Pivot Tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-15 : 07:51:06
Rosendo writes "Just to let you know I’m new at this. I have a table with the raw data. I setup the qry and it runs great! I created another table to dump the data after running the procedure. My goal is put that data into that table after I run it. Below is an example of what I’m trying to do, but every time I get any error “Insert Error: Column name or number of supplied values does not match table definition.”, so I’ve added the new “pivot column” to the table but I still get the same error. Thanks for any help.

INSERT INTO MAIN_TABLE

execute crosstab 'select order_num from main_pull group bys order_num, 'max(datetime_in)','next_station','main_pull'"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-16 : 01:46:07
You have specify the columns explicitely

INSERT INTO MAIN_TABLE(columnLists)
execute crosstab 'select order_num from main_pull group bys order_num, 'max(datetime_in)','next_station','main_pull'"

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -