易截截图软件、单文件、免安装、纯绿色、仅160KB

问个SQL语句啊 - MS-SQL Server / 疑难问题

查出cx包裹5的...但是不要查出来15,25,35,之类的

1L正解我蹭分

SQL code:
--> 测试数据:[tb]
if object_id('[tb]') is not null drop table [tb]
go
create table [tb](cx varchar(8))
insert [tb]
select '1,' union all
select '5,12' union all
select '15,23,' union all
select '25,35,' union all
select '55,105' union all
select '2,3,4,5,' union all
select '5,'

--------------------------------查询开始------------------------------

select * from [tb] where charindex(',5,',','+cx)>0
/*

(7 行受影响)
cx
--------
5,12
2,3,4,5,
5,

(3 行受影响)


*/


SQL code:
select * from [tb] where ',5,' like '%'+','+cx+','+'%'


SQL code:


select * from table
where charindex(',5',cx)>0



--改下
SQL code:

select * from table
where charindex(',5,',cx)>0




SQL code:
--or
select * from [tb] where ','+cx like '%,5,%'

{{----


相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

SQL如何优化问题 - MS-SQL Server / 疑难问题

今天做了一个存储过程   环境是SQL2000数据库  
大致如下
建立临时表
定义员工游标
        循环员工(属于1个公司)  
        ......

MS SQL作业问题 - MS-SQL Server / 应用实例

如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP

参考:http://hi.baidu.com/toiota ......

请教SQL语句查询问题? - MS-SQL Server / 基础类

我想查询出每天数据的最大的一个值。表的格式如下
表名: hisdata
字段 编号 值 状态 时间  
  Id value state dattime  
  101 32.3 0 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号