重工电子论坛

标题: 【求助】一条select语句的问题 测试发帖 [打印本页]

作者: 李维强-15级    时间: 2015-5-10 15:19
标题: 【求助】一条select语句的问题 测试发帖
在用select查询的时候出现了疑惑,
操作环境  
VC6   
XP SP3   
SQL SERVER 2000

先上表属性


这个表我用以下语句创建

[SQL] syntaxhighlighter_viewsource syntaxhighlighter_copycode

create table ProductInfo
(
seq_id                smallint identity(1,1) primary key,
productSerial        varchar(100),
productItem        varchar(100),
SerialNum                varchar(1000),
BeginPosition        varchar(100),
InterceptLength        varchar(100)
)

我的要求是查询行的信息,并且这一行中列的数据符合SerialNum='2' and productSerial<>'TEST' and productItem<>'070_01'
具体查询语句为
[SQL] syntaxhighlighter_viewsource syntaxhighlighter_copycode


select * from ProductInfo where SerialNum='2211' and productSerial<>'TEST' and productItem<>'070_01'



下面是正常返回查询的截图


但是我同样用类似查询语句去查询,查询分析器正常执行,但是就是返回值明显不正确
下面是错误的截图
具体查询语句为:
[SQL] syntaxhighlighter_viewsource syntaxhighlighter_copycode

select * from ProductInfo where SerialNum='12131' and productSerial<>'TEST' and productItem<>'070_01'


查询截图


下面是另外一个错误示例
具体查询语句为:
[SQL] syntaxhighlighter_viewsource syntaxhighlighter_copycode

select * from ProductInfo where SerialNum='2' and productSerial<>'TEST' and productItem<>'070_01'


查询截图

我想问一下为什么?









作者: 周鹏    时间: 2015-5-11 01:11
product_serial这个条件
作者: 周鹏    时间: 2015-5-11 01:13
另外,感觉数据字段好大....
作者: 李维强-15级    时间: 2015-5-13 00:44
周鹏 发表于 2015-5-11 01:13
另外,感觉数据字段好大....

这个问题解决了的   我只是试着发个帖子




欢迎光临 重工电子论坛 (http://www.cqutlab.cn/) Powered by Discuz! X3.1