select replace(col,'?','') from tabname

解决方案 »

  1.   

    select replace(col,'?','') from tabname
      

  2.   


    没有超过 8000 的长度可以这样处理
    select replace(cast(colname as varchar(8000)),'d','') from tablename
      

  3.   

    text类型支持字符串replace()函数
      

  4.   

    select replace(col,'?','') from tabname
      

  5.   


    ----SQL SERVER 2000 是不支持的
      

  6.   

    ---大于8000的处理方法
    ---注:一次只能处理一条记录
    CREATE TABLE #(TextCol Text)
    INSERT INTO # SELECT 'DDAGSAG?DSF?DDSFSDFS?444GDSFD'
    GODECLARE @CharIndex  int
    DECLARE @val varbinary(16)
    SET @CharIndex=1
    WHILE @CharIndex IS NOT NULL
    BEGIN
    SET @CharIndex=null
    SELECT @val = TEXTPTR(TextCol),@CharIndex=patindex('%?%',TextCol) FROM # where TextCol like '%?%'
    IF @CharIndex IS  NULL RETURN
    SET @CharIndex=@CharIndex-1
            UPDATETEXT #.TextCol @val @CharIndex 1 ''
     
    END 
    GO
    SELECT * FROM #
    GO
    DROP TABLE #
      

  7.   

    小于8000,直接replace() ,并设置text in row直接保存在行内在于8000分段取,

    create proc pr_test
    @id int,
    @s int,
    @len int
    as 
    begin
    DECLARE @ptrval varbinary(16)SELECT @ptrval = TEXTPTR(col) 
       FROM ta 
    where id = @idREADTEXT ta.col  @ptrval @s @lenend
    go
    create table ss(s text)
    go
    insert ss exec pr_test 1,1,22
    select * from ss