joining several update queries into one

V

VMI

I have several update queries that I need to run but I would like to join
them all into one:

update audit set field1 = "" where field1 is null
update audit set field2 = "" where field2 is null
update audit set field3 = "" where field3 is null
update audit set field4 = "" where field4 is null
update audit set field5 = "" where field5 is null

How can I join these 5 queries into 1?

thanks.
 
A

Andi Mayer

I have several update queries that I need to run but I would like to join
them all into one:

update audit set field1 = iif( field1="",Null,field1),
field2 = iif( field2 =""l,Null,field2),
field3 = iif( field3="",Null,field3),
field4 = iif( field4 ="",Null,field4),
field5 = iif( field5="",Null,field5)


If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
D

Douglas J. Steele

update audit set field1 = Nz(field1, ""), field2 = Nz(field2, ""), field3 =
Nz(field3, ""), field4 = Nz(field4, ""), field5 = Nz(field5,"")
 
D

Douglas J. Steele

That's not the same as what was originally posted:
update audit set field1 = "" where field1 is null
update audit set field2 = "" where field2 is null
update audit set field3 = "" where field3 is null
update audit set field4 = "" where field4 is null
update audit set field5 = "" where field5 is null
 
A

Andi Mayer

That's not the same as what was originally posted:
you are right I exchanged "" with null
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top