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.
Author |
Topic |
jliberti
Starting Member
2 Posts |
Posted - 2011-04-15 : 10:58:52
|
Hi, Im hoping someone can help, I am trying to run an append query. Here is the syntax:INSERT INTO QS36F_AVHOLDSELECT tc234.*FROM tc234;I am getting the follwing error:The INSERT INTO statement contains the following unknown field name: 'BBLE'. Make sure you have typed the name correctly and try the operation again.I have checked the field name for spaces and other bad characters but found nothing. I have tried enclosing the * in brackets [*] but that just opens a prompt when the query is run.I also tried renamming the field.Nothing has worked.when I run the query without using the * and I specify fields then the query runs with no errorshere is the syntax that works:INSERT INTO QS36F_AVHOLD ( AVBBLE, AVBORO, AVBLOCK, AVLOT )SELECT tc234.BBLE, tc234.BORO, tc234.BLOCK, tc234.LOTFROM tc234;The problem with running this code is that it only fills the target table with the fields that are listed. I need all the fields to be fileld in. How can I get all the data from tc234 to qs36f_avhold without getting this error?Thanks |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2011-04-18 : 05:02:35
|
Best practice: avoid the SELECT * syntax.It is open to problems if the input table gains now columns after initial deployment.In this instance you may also have a problem with the sequence of the columns matching your INSERT table. |
|
|
jliberti
Starting Member
2 Posts |
Posted - 2011-04-18 : 09:09:01
|
thanks Andrew, the * would have made things simple though. I found a way around it and got the job done. I created a simple select query, then converted it to an append query, then mapped all the fields manually. |
|
|
|
|
|