简体   繁体   English

sybase sql Anywhere 11查询结果不正确

[英]sybase sql anywhere 11 query results are incorrect

I have the following table which has >13.000 rows. 我有下表,其中有> 13.000行。

CREATE TABLE "DBA"."mytable" (
"c1"                    numeric(8,0) NOT NULL,
"c2"                    numeric(2,0) NOT NULL,
"c3"                    numeric(4,0) NOT NULL,
"c4"                    numeric(8,0) NOT NULL,
PRIMARY KEY ("c1","c2","c3","c4") 
)

The following query returns no rows when there are at least two rows that happen to meet the condition: 当至少有两行符合条件时,以下查询将不返回任何行:

select * from mytable A where A.c1=229 and A.c3=1

More strangely, a slightly modified (but same) version of the query returns 2 rows as expected: 更奇怪的是,对该查询进行了稍微修改(但相同)的版本会按预期返回2行:

select * from mytable A where A.c1=229 and A.c3+1=2

Having suspected there is some physical corruption in the db, I have created a new db, created the table with the above code and loaded values from an unload file. 怀疑数据库中存在一些物理损坏后,我创建了一个新的数据库,使用上述代码创建了表,并从卸载文件中加载了值。 The results are the same. 结果是一样的。

I know all four columns in PK is not good design, but this shouldn't be an excuse for the db to return wrong results. 我知道PK中的所有四列都不是很好的设计,但这不应该成为db返回错误结果的借口。 By playing with the column creation order and dropping the PK the problem disappears and reappears. 通过按列创建顺序进行操作并删除PK,问题消失并重新出现。

Does aynbody know a fix or some workaround about this problem? aynbody是否知道有关此问题的修复程序或某些解决方法? The DB is on a Windows 8 64-bit system, the locale is Turkish. 该数据库位于Windows 8 64位系统上,语言环境为土耳其语。

Thanks 谢谢

I remember long ago in the times I used Sybase, that sometimes the table's data get silently corrupted. 我记得很久以前使用Sybase的时候,有时表的数据会被无声破坏。

The only solution we found was to re-create the table and insert the data again. 我们发现的唯一解决方案是重新创建表并再次插入数据。 I'm sorry but that was the only solution we found. 抱歉,这是我们找到的唯一解决方案。 So, you could copy the data to another table, then drop and recreate your table, and finally copy the data back. 因此,您可以将数据复制到另一个表,然后删除并重新创建表,最后将数据复制回。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM