怎样写一条sql语句:把一个表其中一个字符串字段的每一个内容前面都追加字符"ABC"

解决方案 »

  1.   

    update 表 set 一个字符串字段='ABC'+一个字符串字段
      

  2.   

    select 'ABC'+col from tb
      

  3.   

    update students set username='ABC'+username 
      

  4.   

    update tb set col=stuff(col,charindex('指定字符',col)-1,0,'ABC')
      

  5.   

    declare @t table(col varchar(20))
    insert @t select 'ccc'
    union all select 'ddd'update @t set col=stuff(col,1,0,'ABC')select * from @t
    /*
    col
    --------------------
    ABCccc
    ABCddd(2 行受影响)*/