Home > Archive > MS SQL Server MSEQ > June 2005 > Wildcard with Update









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Wildcard with Update
Donn

2005-06-01, 8:24 pm

SQL 7.0
Need to replace all
AB 2005-XXX
with
C 2005-YYY
Thinking about the following...but, the '%' is taken as a literal in 'C%-YYY'.
update table
set f1 = 'C%-YYY'
where f1 like 'AB%-XXX'
Thanks,
Don

Hugo Kornelis

2005-06-01, 8:24 pm

On Wed, 1 Jun 2005 12:47:21 -0700, Donn wrote:

>SQL 7.0
>Need to replace all
> AB 2005-XXX
>with
> C 2005-YYY
>Thinking about the following...but, the '%' is taken as a literal in 'C%-YYY'.
>update table
>set f1 = 'C%-YYY'
>where f1 like 'AB%-XXX'
>Thanks,
>Don


Hi Don,

Try if this works:

UPDATE MyTable
SET F1 = STUFF(F1, 1, 2, 'C')
WHERE F1 LIKE 'AB%-XXX'

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com