SQL Select * 并投射其中一个变量

SQL Select * and cast one of those variables

我在 TeraData 工作,我想 select 所有 table 中的列,除非我需要投射一个其中。有没有一种简单的方法不用每次都写出所有的列名

这描述了我想做的事情:

SELECT top 500 *,
       cast( cast(var AS format 'Z(I)' ) AS varchar(18) ) as casted_var
FROM db.tbl

如果您为 table 添加别名,您可以这样做:

select top 500 t1.*, 
cast(..) as <some clever alias> 
from db.tbl t1. 

然而正如其他人所说,最好写出 select 列表。1