查出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,%'
{{----
可能因为工作的原因 接触数据库这块比较少,之前都是做程序这块,数据库这块都有专门的人来做 分工都很明细 所以对数据库这一块完全不了解。前段时间 去面试了几家公司 几乎都是在数据库这块挂掉的 连个简单的SQ ......
sqlserver2005 建立的数据库,与手持pda传输数据,最近突然出现无法传递数据的问题,pda端提示的错误时outofmemoryexception,但是pda上面的容量没有问题,
sqlserver的日子上的错误如下:
日期 2010-1-25 14:45: ......