CAST和CONVERT在SQL中是否相同? [英] Are CAST and CONVERT the same in SQL?
问题描述
可能重复:
T-SQL Cast与Convert
SQL中的 CAST
和 CONVERT
之间的区别是否会执行数据类型转换?
What is the major difference between CAST
and CONVERT
in SQL cause both performs data type conversion?
推荐答案
CAST和CONVERT具有类似的功能。 CONVERT特定于SQL Server,并且在日期和时间值,小数和货币符号之间转换时允许更大的灵活性。 CAST是两个函数中的ANSI标准。请查看此博客,了解使用这两种方法的示例: http:// sqltutorials.blogspot.com/2007/06/sql-cast-and-convert.html
CAST and CONVERT have similar functionality. CONVERT is specific to SQL Server, and allows for a greater breadth of flexibility when converting between date and time values, fractional numbers, and monetary signifiers. CAST is the more ANSI-standard of the two functions. Check this blog for examples of using both of those: http://sqltutorials.blogspot.com/2007/06/sql-cast-and-convert.html
这篇关于CAST和CONVERT在SQL中是否相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!