[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1061
  • Last Modified:

cast vs convert

how do i decide which to use: cast() or convert() in t-SQL
0
vinny45
Asked:
vinny45
  • 2
2 Solutions
 
jdlambert1Commented:
You didn't find that clearly documented?? Neither did I. :)

I use Cast unless I need the extra "style" argument of Convert, but if you don't need the optional style, it makes no difference in performance or results.
0
 
arbertCommented:
Straight from books online:

"CAST is based on the SQL-92 standard and is preferred over CONVERT."
0
 
jdlambert1Commented:
Ah, yes, the old "Look under 'Data Type Conversion' instead of Cast or Convert" trick.  Thanks, Brett!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now