4

Using MS Access, can I run multiple UPDATE statements in one SQL query?

Say I have a table with columns A-F. What I want to do is this:

UPDATE table SET C = NULL WHERE C = 0
UPDATE table SET D = NULL WHERE D = 0
UPDATE table SET E = NULL WHERE E = 0

I understand that with SQL Server I could use a 'GO' after each line but that doesn't seem to work with Access. Is there an alternative, or do I just have to run a load of separate queries?

1 Answer 1

9
UPDATE table SET 
  C=IIF(C=0,NULL,C),
  D=IIF(D=0,NULL,D),
  E=IIF(E=0,NULL,E)
WHERE
  C=0 OR D=0 OR E=0
Sign up to request clarification or add additional context in comments.

1 Comment

This is a correct answer to your question. But an added note just case you or someone else reading this sees it, you can only update one table at a time.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.