T-SQL实例,学习下将函数结果作为别名列的方法。
代码:
1> 2> CREATE TABLE ConvertTest 3> ( 4> ColID int IDENTITY, 5> ColTS timestamp 6> ) 7> GO 1> INSERT INTO ConvertTest DEFAULT VALUES 2> GO (1 rows affected) 1> SELECT ColTS AS "Uncoverted", CAST(ColTS AS int) AS "Converted" FROM ConvertTest 2> GO Uncoverted --------------------------- 0x000000000000138A (1 rows affected) --删除测试用表,上面用来测试别名列用到 1> drop table convertTest; 2> GO