Hello,
I have a table [QUESTOR Run tbl] and a duplicate table [QUESTOR Run tbl1] whose definition is smiliar to T but is empty without any values and also no primary key. my task is to
insert into QUESTOR Run tbl1 some values from QUESTOR Run tbl
I used the following Query:
INSERT INTO [QUESTOR Run tbl1][ID[, QUE$TOR Version Name[, Project ID[, Cost Tab[, Group[, Item[, Quantity[, Unit Rate[, Cost]]]]]]]]] SELECT [[QUESTOR Run tbl.]ID[, QUE$TOR Version Name[, Project ID[, Cost Tab[, Group[, Item[, Quantity[, Unit Rate[, Cost]]]]]]]] FROM [QUESTOR Run tbl] WHERE [QUESTOR Run tbl].[QUE$TOR Version Name]='7.3'
It comes up with an error in INSERT INTO statement.
What am i doing wrong here. I need help. Thank you.
7 2836
You've used square brackets wrongly in alot of places. Give this a try: -
INSERT INTO [QUESTOR Run tbl1] ([ID], [QUE$TOR Version Name], [Project ID], [Cost Tab], [Group], [Item], [Quantity], [Unit Rate], [Cost])
-
SELECT [ID], [QUE$TOR Version Name], [Project ID], [Cost Tab], [Group], [Item], [Quantity], [Unit Rate], [Cost]
-
FROM [QUESTOR Run tbl]
-
WHERE [QUESTOR Run tbl].[QUE$TOR Version Name]='7.3'
-
You've used square brackets wrongly in alot of places. Give this a try: -
INSERT INTO [QUESTOR Run tbl1] ([ID], [QUE$TOR Version Name], [Project ID], [Cost Tab], [Group], [Item], [Quantity], [Unit Rate], [Cost])
-
SELECT [ID], [QUE$TOR Version Name], [Project ID], [Cost Tab], [Group], [Item], [Quantity], [Unit Rate], [Cost]
-
FROM [QUESTOR Run tbl]
-
WHERE [QUESTOR Run tbl].[QUE$TOR Version Name]='7.3'
-
Thank you very much. I used the same and now it gives me a Run time Error 3079: The specified field '[Project ID]' could refer to more than one table listed
in the FROM clause of your SQL statement. Where is the mistake? I am talking data from one table [QUESTOR Run Tbl] into [ QUESTOR Run tbl1].
Did you alter what I wrote at all?
I don't believe you need to specify tablenames for all fields in this case.
Make sure your FROM line only has the one table name.
Thank you very much. I used the same and now it gives me a Run time Error 3079: The specified field '[Project ID]' could refer to more than one table listed
in the FROM clause of your SQL statement. Where is the mistake? I am talking data from one table [QUESTOR Run Tbl] into [ QUESTOR Run tbl1].
Preface the Fields in the SELECT Clause with the proper Table Identifier and you should be OK: - INSERT INTO [QUE$TOR Run tbl1] ( ID, [QUE$TOR Version Name], [Project ID], [Cost Tab], [Group], Item, Quantity, [Unit Rate], Cost )
-
SELECT [QUESTOR Run tbl].ID, [QUESTOR Run tbl].[QUE$TOR Version Name], [QUESTOR Run tbl].[Project ID],
-
[QUESTOR Run tbl].[Cost Tab], [QUESTOR Run tbl].Group, [QUESTOR Run tbl].Item, [QUESTOR Run tbl].Quantity,
-
[QUESTOR Run tbl].[Unit Rate], [QUESTOR Run tbl].Cost
-
FROM [QUESTOR Run tbl]
-
WHERE ((([QUESTOR Run tbl].[QUE$TOR Version Name])="7.3"));
Did you alter what I wrote at all?
I don't believe you need to specify tablenames for all fields in this case.
Make sure your FROM line only has the one table name.
Yes I did, Infact I tried icluding the full name for each field like :
INSERT INTO [QUESTOR Run tbl1] ([ID], [QUE$TOR Version Name], [Project ID], [Cost Tab], [GROUP], [Item], [Quantity], [Unit Rate], [Cost])
SELECT [QUESTOR Run tbl].[ID], [QUESTOR Run tbl].[QUE$TOR Version Name], [QUESTOR Run tbl].[Project ID], [QUESTOR Run tbl].[Cost Tab], [QUESTOR Run tbl].[GROUP], [QUESTOR Run tbl].[Item], [QUESTOR Run tbl].[Quantity], [QUESTOR Run tbl].[Unit Rate], [QUESTOR Run tbl].[Cost]
FROM [QUESTOR Run tbl]
WHERE [QUESTOR Run tbl].[QUE$TOR Version Name]='7.3'
Preface the Fields in the SELECT Clause with the proper Table Identifier and you should be OK: - INSERT INTO [QUE$TOR Run tbl1] ( ID, [QUE$TOR Version Name], [Project ID], [Cost Tab], [Group], Item, Quantity, [Unit Rate], Cost )
-
SELECT [QUESTOR Run tbl].ID, [QUESTOR Run tbl].[QUE$TOR Version Name], [QUESTOR Run tbl].[Project ID],
-
[QUESTOR Run tbl].[Cost Tab], [QUESTOR Run tbl].Group, [QUESTOR Run tbl].Item, [QUESTOR Run tbl].Quantity,
-
[QUESTOR Run tbl].[Unit Rate], [QUESTOR Run tbl].Cost
-
FROM [QUESTOR Run tbl]
-
WHERE ((([QUESTOR Run tbl].[QUE$TOR Version Name])="7.3"));
I just tried like what you described above. it still gives me the same error.
I just tried like what you described above. it still gives me the same error.
I got it. My first mistake was in the [QUESTOR Run tbl] the field [Project ID] did not have a space meaning it was [ProjectID] and there was a single quote missing after 7.3
My mistakes were silly. sorry about that. And thank you very much for helping.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Karen Middleton |
last post by:
In MS Access I can do in one SQL statement a update if exists else a
insert.
Assuming my source staging table is called - SOURCE and my target
table is called - DEST and both of them have the...
|
by: robert |
last post by:
been ruminating on the question (mostly in a 390/v7 context) of
whether, and if so when, a row update becomes an insert/delete.
i assume that there is a threshold on the number of columns of
the...
|
by: 2BaCook |
last post by:
Hi, I have an Access database that I am creating a java front end to.
I am trying to insert a record into a table and get a problem whenever
I try to insert into my "Number" column.
Here is my...
|
by: terpatwork |
last post by:
Hi,
(1) I have an access form that allows users to enter data, and when
they click a button, the OnClick code that I've written uses a SQL
INSERT statement to insert the data into the database. I...
|
by: kosta |
last post by:
hello! one of my forms communicates with a database, and is
supposed to add a row to a table using an Insert
statement... however, I get a 'oledb - syntax error'
exception... I have double...
|
by: Geoffrey KRETZ |
last post by:
Hello,
I'm wondering if the following behaviour is the correct one for
PostGreSQL (7.4 on UNIX).
I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching
the following request :...
|
by: Cindy H |
last post by:
Hi
I'm having a problem getting the insert statement correct for an Access
table I'm using.
The Access table uses an autonumber for the primary key.
I have tried this:
INSERT INTO Tournaments...
|
by: rn5a |
last post by:
During registration, users are supposed to enter the following
details: First Name, Last Name, EMail, UserName, Password, Confirm
Password, Address, City, State, Country, Zip & Phone Number. I am...
|
by: Dave |
last post by:
I have an old web app that ues an Access database and ASP 3.0.
I need to build an INSERT statement based on the contents of a form.
What is the best way to handle blank text boxes that are...
|
by: Greg Corradini |
last post by:
Hello,
I'm trying to perform a simple insert statement into a table called
Parcel_Test (see code below). Yet, I get an error message that I've never
seen before (see traceback below). I've tried...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |