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!

CHARINDEX PROBLEM

Status
Not open for further replies.

Rachel30

Programmer
Mar 1, 2005
95
GB
Hi,

I have a description field that I want to Interrogate. Basically some of the sting have words in and I want to delete anything after that word.
one is Uk another is loaded and some of them dont have anything at the end of the string I wish to delete. Can you please advise the best way to go around this. Thanks

I have started with this:-

Left(SPP.sProductDescription, CHARINDEX 'UK' ,SPP.sProductDescription ,0)-1)
 
Can you simply ignore records via WHERE clause? Something like
Code:
UPDATE spp
set sProductDescription = Left(SPP.sProductDescription, CHARINDEX( 'UK' ,SPP.sProductDescription ,0)-1)
[b]where charindex('UK', sProductDescription ) > 0[/b]

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top