select notes from agency DECLARE @lcOldString varchar(8000) SET @lcOldString = 'DATE RECOVERED:' DECLARE @lcNewString varchar(8000) SET @lcNewString = 'DATE RECEIVED:' update agency set notes = replace(CAST(notes as varchar(8000)),@lcOldString,@lcNewString) select notes from agency>You can not use REPLACE with Text, local variables are OK :-)
>UPDATE #TestTable SET ColText = CAST(REPLACE(CAST(ColText as varchar(8000)),'START TAG','NEW TAG') AS Text) >>
>>>>select * from agency >>>>DECLARE @lcOldString varchar(200) >>>>SET @lcOldString = 'HIGH POINT' >>>>DECLARE @lcNewString varchar(200) >>>>SET @lcNewString = 'TRACY' >>>>update agency set agencyname = REPLACE(agencyname,@lcOldString,@lcNewString) >>>>select * from agency >>>>>>>>
>>>>>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 >>>>>>>>>>
>>>>>>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) >>>>>>>