Remove text from text field

  • I was wondering if there is a way to remove some text from a column of data type text. What I mean, is what if I don't want the text 'ABC' to appear anymore, how do I remove it.  I know how to do it with character fields, but it doesn't work for text. 

    An example of what I am asking is, what if the field is 'Something ABC' and I really want it to be just 'Something'

  • Here is a quick sample.  The wording in @match will be removed from the FormData column in the Extract table.

     

    DECLARE

    @PtrVar BINARY(16)

    DECLARE

    @InsertPos INT

    DECLARE

    @DeleteLen INT

    declare

    @Match varchar(1000)

    set

    @Match = '<?xml version="1.0" encoding="utf-16"?> ' set @DeleteLen = len(@Match)

    SELECT

    @PtrVar = TEXTPTR(FormData)

    FROM

    dbo.Extract

    WHERE

    ExtractId = @ExtractId

    UPDATETEXT

    Extract.FormData

    @PtrVar

    0

    @DeleteLen

    WITH LOG

    ''

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply