Link to home
Start Free TrialLog in
Avatar of BKaporch
BKaporch

asked on

Query must have at least one destination field - delete query

I'm trying to run the following delete query against my table:

DELETE FROM Reservation WHERE ReservationID=1112716201

ReserverationID is defined as a numeric (primary key) field.  There are no relationships between the tables in my database.  I'm not sure what this error means or how to adjust my query.
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Statement looks good, the problem maybe is on the scripts you execute that statement, can you post it here?
In additional, for executing a Delete statement, always try a Execute method, like:

...
SQLstr = "DELETE FROM Reservation WHERE ReservationID=1112716201"
conn.execute SQLstr
...
Avatar of BKaporch
BKaporch

ASKER

There were no scripts for the query, this was an ad-hoc query that I saved in the database.  
Some database management systems require (as this one also seems to do) that you format the delete statement as following:

delete * from reservation where reservationID=1112716201

Which DBMS are you actually using?
What's your database you using? Are you able to execute able statement in that database's query builder ? or you facing the problem as what stated on your question title when you try to execute it inside the database's query builder?

regards
I'm using Access.  The query is failing in query builder.  
I just done a test on my side, query executed successfully under my enviroment without problem, record is deleted successfully..

My suggestion is try to compact the Access database, and then try again your statement there...

If still not working, try to create a new empty database, import all database elements (tables, queries, reports, etc) from the current database to that new database, and then try execute your statement there.

Good Luck!
Bkaporch,
I'm not sure why your query isn't working. I recreated the table and query, and it deletes with no problems. My SQL string is below:

DELETE reservations.reservationID
FROM reservations
WHERE (((reservations.reservationID)=1112716201));

Good luck.
ASKER CERTIFIED SOLUTION
Avatar of wzard
wzard

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You need to describe what you want to delete after DELETE command... Thus use

DELETE [field u want to delete] FROM Reservation WHERE ReservationID=1112716201
instead
DELETE FROM Reservation WHERE ReservationID=1112716201

If you want to delete all ocurencies, use
DELETE * FROM Reservation WHERE ReservationID=1112716201

regards,
Raoul
wzard is right.
Wzard is correct. sometimes the simplest thing is the most overlooked.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
   Accept: wzard

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

John Bush
EE Cleanup Volunteer