0

when i give this sql query in my msaccess database table called warehouse1 it gives this error

"operation must use an updateable query?"

UPDATE warehouse1 SET STD_MOU = "?"
WHERE warehouse1.[STD_MOU]="null";

what could be the reason ?

2
  • Updating a null field to ? does not look like a good idea. If you are looking for Nulls, you should use : Is Null I strongly suspect that warehouse1 is a query, not a table.
    – Fionnuala
    Commented Mar 2, 2010 at 11:39
  • 1
    If [STD_MOU] a text field, and are there rows with the literal letters "null" stored in it? Or are you looking for empty fields, i.e., Null fields? If so, you need Where [STD_MOU] Is Null. Also, this question reminds me of one from a while back that was almost identical. It's not clear whether you intend the ? to be a parameter or if you want to actually change the Null fields (or the fields with the word "null" in them) to a question mark. Commented Mar 3, 2010 at 1:24

1 Answer 1

1

Alternative interpretations of the SQL given:

  1. As posted: find the fields with the literal word "null" in them and replace them all with the literal question mark.

  2. Ask the user for the value they want to replace all Nulls with:

      UPDATE warehouse1 SET STD_MOU = [?]
    WHERE warehouse1.[STD_MOU] Is Null;

  3. Ask the user for the value they want to replace the word "null" with:

      UPDATE warehouse1 SET STD_MOU = [?]
    WHERE warehouse1.[STD_MOU]="null";

I don't find any of these to be particularly advisable. This would be OK, though:

  UPDATE warehouse1 SET STD_MOU = Null
  WHERE warehouse1.[STD_MOU]="null";

Nulls are good and shouldn't be avoided at all.

9
  • But none of this will solve "Operation must use an updateable query", which seems likely to be due to running against a query rather than a table.
    – Fionnuala
    Commented Mar 3, 2010 at 11:31
  • OK, yes, I didn't really answer the question. But the SQL is clearly faulty or doing something that shouldn't be done in the first place. I suspect it's been edited for posting so that the salient point has been edited out. Or course, it's been accepted as the answer, so it would be nice to know for sure that it somehow solved the non-updatable problem. Can't see how it would unless there's more involved than we know. Commented Mar 4, 2010 at 18:27
  • @David W FentonIt is a pity, your comments are clearly useful, but would be more useful if they could be tailored to the question title.
    – Fionnuala
    Commented Mar 4, 2010 at 20:11
  • Does every answer have to directly address the question? Isn't an answer useful if it applies to an issue raised in the question? Commented Mar 5, 2010 at 20:49
  • Did I not say the answer was useful? Why not take my comment as a mild compliment as it was intended, and not as a criticism?
    – Fionnuala
    Commented Mar 6, 2010 at 1:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.