View Single Post
  #4 (permalink)  
Old October 25th, 2004, 09:29 PM
happygv happygv is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes, for text datatypes Replace, wouldn't work. There is a workaround for this.
Code:
Declare @val varchar(8000)
Select @val=EMAILCOL from TABLENAME where PRIMARYKEYCOL = ItsValue
-- select @val
update TABLENAME set EMAILCOL = replace(@val,'oldval','newval') where PRIMARYKEYCOL = ItsValue
Select EMAILCOL from TABLENAME where PRIMARYKEYCOL = ItsValue
This would work only if the length of that column doesn't exceed 8000 characters. I would suggest you not to use text for that column. Check what is the maximum length of that column? If that is not more than 8000, you may change that to varchar(8000) in the table structure. Assuming a MailId doesn't exceed 40 characters at the maximum, does that column contain more that 200 EMail Ids? If that is going to be less than that, you can blindly modify its datatype to be varchar(8000 or less)

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection