所有字符串函数都不可以用于 text 类型的参数上
考虑用varchar() 代替下 text 实现?

解决方案 »

  1.   

    由于@phone这个变量是不定的,但是在大于8000时就会截取了字符串.
      

  2.   

    可以这样吗?用三个@sql1 @sql2,@sql3 varchar(8000)
      

  3.   

    CREATE TABLE tb (c1 int, c2 text)INSERT TB
    SELECT 1,'adsf3' UNION ALL
    SELECT 100,'we23' UNION ALL
    SELECT 2,'skfjdkjfsdkf9' UNION ALL
    SELECT 40,'kdsjfkiqeuriepm,xkfj13'select *,substring(c2,1,4) from tb
    drop table tb
      

  4.   

    功能是反过来的.有相应的函数?substring().这个不支持?
      

  5.   

    CREATE TABLE tb (c1 int, c2 text)
    c1 自动标识
    declare @i int
    while len(@phone)<70
    begin
    select @i=1
    select substring(@phone,i,70) 
    insert tb values substring(@phone,i,70)
    select @i=@i+1
    end