表Table 1
字段SendDate 文本类型
值,"1-2","3-4","5-6","7-8","9-10","11-12"sSQL := 'select * from Table1 where SendDate >='1-2'and SendDate <='11-12'';这样查询就会出错,因为"11-12"<"1-2" 有什么方法在数据库内容不对的情况下,查询正确呢????
字段SendDate 文本类型
值,"1-2","3-4","5-6","7-8","9-10","11-12"sSQL := 'select * from Table1 where SendDate >='1-2'and SendDate <='11-12'';这样查询就会出错,因为"11-12"<"1-2" 有什么方法在数据库内容不对的情况下,查询正确呢????
sSQL := 'select * from Table1 where SendDate >=''1-2'' and SendDate <=''11-12''';
--测试数据
create table table1( SendDate varchar2(4000));
insert into table1 values('"1-2","3-4","5-6","7-8","9-10","11-12"');
--执行查询
select
substr( SendDate,instr(SendDate,'"1-2"',1),instr(SendDate,'"11-12"',1)+length('"11-12"') )
from table1
--输出结果
"1-2","3-4","5-6","7-8","9-10","11-12"
select
SUBSTRING( SendDate,CHARINDEX('"1-2"',SendDate),CHARINDEX('"11-12"',SendDate)+len('"11-12"') )
from table1
select
mid( SendDate,instr(SendDate,'"1-2"'),instr(SendDate,'"11-12"')+len('"11-12"') )
from table1