  |  
  |  
 
Archives of the TeradataForum 
 
 
Message Posted: Thu, 13 Oct 2005 @ 16:29:22 GMT 
 
  
 
 
 
 
  
|  Subj:  |   |  Replace Text Function  |   
|     |   
|  From:  |   |  Phil.Oldfield  |   
  
 
 
  
Is there a way in teradata through SQL or a procedure/function to 'find and replace' text ? 
 I am trying to convert the following SQL server function 
     CREATE FUNCTION .fnTextClean
     (@string_expression1 nvarchar(4000))
     RETURNS nvarchar(4000)
     AS
     BEGIN
           DECLARE @tempstring AS nvarchar(4000)
           SET @tempstring=RTRIM(@string_expression1)
           SET @tempstring=REPLACE (@tempstring, """", "``")
           SET @tempstring=REPLACE(@tempstring,"'","`")
           SET @tempstring=REPLACE(@tempstring,"?","?")
           SET @tempstring=REPLACE(@tempstring,"&","and")
           SET @tempstring=REPLACE(@tempstring,"+","and")
           RETURN @tempstring
     END
 Phil Oldfield 
Teradata Developer 
Iceland Foods Data Warehouse 
 
 
 
 
   
 
 |   |