tags:

views:

71

answers:

2

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 ?

A: 

the "?" is a parameter in ms acces's sql, maybe "[?]" will help you.

remi bourgarel
No it won't. Please see my notes.
Remou
About null, maybe he really put the string "null" into a field.
remi bourgarel
+1  A: 

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.

David-W-Fenton
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.
Remou
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.
David-W-Fenton
@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.
Remou
Does every answer have to directly address the question? Isn't an answer useful if it applies to an issue raised in the question?
David-W-Fenton
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?
Remou
How could my answer be tailored to the question? If you have some ideas for that, I'd love to hear it, as I'd be glad to make my answer more topical. If not, I'm wondering why you made the observation -- I'm not offended or insulted or whatever, as your observation is demonstrably true, just wondering what it was intended to accomplish.
David-W-Fenton
@David W Fenton You said "...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." I said "It is a pity etc" It was intended as a mild compliment and an equally mild note of sympathy. I won't do it again, it leads to such confusion.
Remou
I think we're encountering the difficulties that come with text-only communication -- I wasn't responding in anything like a friendly way to your compliment. I was just going with the usefulness component of your comment. Yet another disagreement between those 99.99% in agreement!
David-W-Fenton
Ack. Where I was say "not responding in anything like a friendly way" I meant "not responding in anything like an UNFRIENDLY way". Geez. What a communication breakdown.
David-W-Fenton