Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Like statement?

Status
Not open for further replies.

Schaeffrcc

Technical User
May 29, 2003
19
US
I have a Query that pulls a subset of data into a temp table and then has to look for field that contain a Char. it looks like below:

UPDATE clients SET clients.client_city = Null
WHERE (((clients.client_city)=" "));

Now I also want this statement or another one to update the field to Null if it contains the " " anywhere in the field I.E. Minn eapolis should be updated to Null.

can anyone help,

Thomas
 
Does this help:

UPDATE clients SET clients.client_city = Null
WHERE (((clients.client_city) LIKE '% %'));

-VJ
 
I know the original poster asked for a LIKE solution, but you might want to see if CHARINDEX performs faster than a like with two % signs:

Code:
UPDATE clients 
SET clients.client_city = NULL
WHERE CHARINDEX(' ', clients.client_city)>0
[CODE]

Of course, if not updating 10s of 1000s of recs it probably doesn't matter.

TR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top