Solved

cast vs convert

Posted on 2004-09-27
3
1,003 Views
Last Modified: 2010-08-05
how do i decide which to use: cast() or convert() in t-SQL
0
Comment
Question by:vinny45
  • 2
3 Comments
 
LVL 15

Assisted Solution

by:jdlambert1
jdlambert1 earned 250 total points
ID: 12165196
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
 
LVL 34

Accepted Solution

by:
arbert earned 250 total points
ID: 12165249
Straight from books online:

"CAST is based on the SQL-92 standard and is preferred over CONVERT."
0
 
LVL 15

Expert Comment

by:jdlambert1
ID: 12165288
Ah, yes, the old "Look under 'Data Type Conversion' instead of Cast or Convert" trick.  Thanks, Brett!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now