本文介绍了Ansi SQL类型转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否允许在ANSI SQL中强制转换类型,例如在postgres中

SELECT SUM( CAST(qnty AS int) - CAST(reserve AS int) )  AS sum
...

qnty reserve 是字符列.

解决方案

在SQL-92中添加了CAST表达式.例如,您可以在草稿中看到它.. >

Is it allowed to cast types in ANSI SQL like in postgres for example:

SELECT SUM( CAST(qnty AS int) - CAST(reserve AS int) )  AS sum
...

qnty and reserve are character columns.

解决方案

The CAST expression was added in SQL-92. You can see it for example in this draft.

这篇关于Ansi SQL类型转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 08:34