SQL字符串截取~ - .NET技术 / C#
数据库有个字段例:aaaaaa,bbbbb,cccccc有什么简单的方法分别取得aaaaaa,bbbbb和cccccc啊,因为他们是和其他表关联的ID,求各位高人指点下~在SQL里面直接能完成的方法~
没太清楚楼主的意思
把一列分成几行,然后join即刻
问题不明白
用循环截取也行的(while,substring)
这是一个例子 LZ看一下!
原始的字符串‘邮箱成功开通
Passwd=Nm,12345,Mailsize=30,Mailname=gtxx_lijie,Displayname=李洁,saa’
现在我们把Mailname和Displayname提取出来,以Displayname为例,大体思路是这样:把‘Displayname=’和前面的数据截取掉,留下后面的数据,
SQL:
Select SUBSTRING(subdesc,CHARINDEX('DISPLAYNAME',subdesc)+12,LEN(subdesc)-CHARINDEX('DISPLAYNAME',subdesc)) from SBMailSubUserLog where subtype like '%员工业务开通%' and mobile in (select distinct mobile from SBMailSubUserLog where subtype like '%员工业务关闭%' and changedate>='2009-01-01 00:32:24.327')
显示出来的就是这样’ 李洁,saa’现在再整理‘,’号之后的数据select left(subdesc,patindex('%,%', subdesc)) from SBMailSubUserLog,然后把它们整合起来,
Select left(SUBSTRING(subdesc,CHARINDEX('DISPLAYNAME',subdesc)+12,LEN(subdesc)-CHARINDEX('DISPLAYNAME',subdesc)),patindex('%,%',SUBSTRING(subdesc,CHARINDEX('DISPLAYNAME',subdesc)+12,LEN(subdesc)-CHARINDEX('DISPLAYNAME',subdesc))))
from SBMailSubUserLog
where subtype like '%员工业务开通%' and
mobile in
(select distinct mobile from SBMailSubUserLog where subtype like '%员工业务关闭%' and changedate&
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
txt 和XML 格式相应
不借助DataSet
导入读取TXT文件
然后直接写入XML(同一文件,不同数据,递增原数据没有被覆盖情况下增加数据.)
教个要点或最好是有个代码提示的
过路好汉 帮个忙撒^^
不会,帮楼主 ......
如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP
参考:http://hi.baidu.com/toiota ......
需求如下:
学院 academy(aid,aname)
班级 class(cid,cname,aid)
学生 stu(sid,sname,aid,cid)
住宿区 region(rid,rname)
宿舍楼 build(bid,rid,bnote) bnote是‘男’/‘女’
宿舍 dorm(did,rid,bid,bedn ......