Link to home
Start Free TrialLog in
Avatar of SDEWIS
SDEWIS

asked on

conditional SQL query to blank out a field

Hi guys

I'm not an SQL query guru by any means, so I'm asking here!

I have an SQL based accounting application.

In my stock records, some of the product records begin with 94xxx.

I field in the same table has been filled in incorrectly for certain 94xxx records, and needs to be blanked out - i.e.be empty.

Trouble is, there's around 4-500 records to go through, something I don't fancy doing by hand!

What would be an SQL query which would search all records beginning with 94 (say, field 1), and delete the contents of field 2 if it contains anything?

thanks in advance

Sean
Avatar of jdlambert1
jdlambert1
Flag of United States of America image

Use the LIKE keyword with the any-set-of-characters wildcard "%":

SELECT *
FROM TableA
WHERE field1 LIKE '94%'
Avatar of SDEWIS
SDEWIS

ASKER

thanks jd, that selects the fields, I'm guessing.

Question is, how do I make field 2 in that selection empty/blank?
ASKER CERTIFIED SOLUTION
Avatar of PaulBarbin
PaulBarbin

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
Avatar of SDEWIS

ASKER

That hit the spot more full on!  Thanks Paul - don't worry, I'll be trying it out on my test/wrecker database first!