`

Sybase sql语句报 void type 错误

    博客分类:
  • DB
阅读更多
遇到一个问题:
Sybase数据,查询当给一个null起别名之后,再根据这个字段过滤是否为null会有报错。
sql语句为:
select * from (select null as test from TestTable) t  where  test is null 

报错信息:
10:56:00  [SELECT - 0 row(s), 0.000 secs]  [Error Code: 403, SQL State: ZZZZZ]  Invalid operator for datatype op: is null type: VOID TYPE.
... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 1 errors]



解决方法:
使用convert函数转换字段就可以了。
select * from (select null as test from TestTable) t  where  test is null convert(varchar(15),test) is null
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics