查询一个单词 。每个 空格后 的一个字母 不是大写的记录 。如:
Aaogn ajgn
Bfng Com
Vfag C Com
那么 查出的记录 就应该是 Aaogn ajgn
先谢谢 了各位
------解决方案--------------------
- SQL code
--> 测试数据:[tb]if object_id('[tb]') is not null drop table [tb]go create table [tb]([name] varchar(20))insert [tb]select 'Aaogn ajgn' union allselect 'Bfng Com' union allselect 'Vfag C Com'--------------开始查询--------------------------select * from [tb] where ascii(substring(name,charindex(' ',name)+1,1)) between 97 and 122/*name--------------------Aaogn ajgn(1 行受影响)*/
------解决方案--------------------
- SQL code
declare @tb table(ssf varchar(120))insert into @tb select 'Aaogn ajgn' union allselect 'Bfng Com ' union allselect 'Vfag C Com'select * from @tb where ASCII(SUBSTRING(SSF,CHARINDEX(' ',ssf,1)+1,1)) not between 65 AND 90
------解决方案--------------------
- SQL code
declare @tb table(ssf varchar(120))insert into @tb select 'Aaogn ajgn' union allselect 'Bfng Com ' union allselect 'Vfag C Com'select * from @tb where ASCII(SUBSTRING(SSF,CHARINDEX(' ',ssf,1)+1,1)) not between 65 AND 90
------解决方案--------------------
- SQL code
create table [#tb]([name] varchar(20))insert [#tb]select 'Aaogn ajgn' union allselect 'Bfng Com' union allselect 'Vfag c Com'select * from [tb] where ascii(substring(name,charindex(' ',name)+1,1)) between 97 and 122这样插入就不对了结果显示为:nameAaogn ajgnVfag c Com