还没明白楼主要求,不过要截取字符串,只有用substring()啊!=========================================================
我的回复,尽可能为你分忧解难!
BLOG:blog.csdn.net/softj --欢迎光临,有更多信息等着你!
QQ群:8476022专研数据库 --大家进来聊一聊!
MSN:[email protected] --这不常用!
Mail:[email protected] --有什么问题可以和我来EMAIL!
=========================================================
我的回复,尽可能为你分忧解难!
BLOG:blog.csdn.net/softj --欢迎光临,有更多信息等着你!
QQ群:8476022专研数据库 --大家进来聊一聊!
MSN:[email protected] --这不常用!
Mail:[email protected] --有什么问题可以和我来EMAIL!
=========================================================
这个是个text类型,也就是说它的长度大于8000.现在要截取字长,长度为120 如str1='13530217562,13530215562,13930214562,13930214566,...'text类型截取操作不行,能不能进行转化成varchar.请教.
substring(@phonetotal,1,120)
declare @phonetotal text
select @phonetotal='13530214562,13530217562,13530215562,13930214562,13930214566,13930219562'
select substring(@phonetotal,1,24)
服务器: 消息 2739,级别 16,状态 1,行 1
对于局部变量,text、ntext 和 image 数据类型无效。
------------------------------------------------------有没新的解决方案
@phonetotal='13530214562,13530217562,13530215562,13930214562,13930214566,13930219562'
就不对
)
declare @c2 varchar(100)
select @c2=[c2] from t1
select substring(@c2,1,24)
drop table t1
)
declare @c2 varchar(100)
select @c2=substring(c2,1,24) from t1
print @c2
drop table t1
/*
13530214562,13530217562,
*/