CAST与CONVERT


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

1,性能:二者一样。
2,区别:CAST 是ANSI标准,Convert不是。CAST对于转换指定日期格式上不满足,而Convert可以。
3,实现上,在MsSql中CAST由Convert实现,即通过:
SELECT CAST ( o.[object_id] AS int)
FROM sys.objects o
在Compute Scalar的属性中查看:
[Expr1037] = 标量运算符(CONVERT(int,[master].[sys].[sysschobjs].[id] as [o].[id],0))
参考:
http://beyondrelational.com/blogs/nakul/archive/2011/07/18/cast-v-s-convert-is-there-a-difference-as-far-as-sql-server-is-concerned-which-is-better.aspx