DECLARE @lcstring varchar(200) DECLARE @lcnewstring varchar(200) select * from agency SET @lcstring = 'HIGH POINT' SET @lcnewstring = 'TRACY' update agency set agencyname = REPLACE(agencyname,@lcstring,@lcnewstring) select * from agency>OK, in SQL Management Studio, how do I set the vars? I have reached a brain cramp and can't believe I cannot think of it. it doesn't like this:
>select * from agency >SET lcstring = 'HIGH POINT' >SET lcnewstring = 'TRACY' >update agency set agencyname = REPLACE(agencyname,lcstring,lcnewstring) >select * from agency >>or
>select * from agency >DECLARE lcstring = 'HIGH POINT' >DECLARE lcnewstring = 'TRACY' >update agency set agencyname = REPLACE(agencyname,lcstring,lcnewstring) >select * from agency >>
>>>lcoldstring = 'old value' >>>lcnewstring = 'new value' >>>UPDATE vhstatus SET vhnote = STRTRAN(vhnote,lcoldstring,lcnewstring) >>>>>>
>>lcoldstring = 'old value' >>lcnewstring = 'new value' >>UPDATE vhstatus SET vhnote = REPLACE(vhnote,lcoldstring,lcnewstring) >>