Solved

cast vs convert

Posted on 2004-09-27
3
1,030 Views
Last Modified: 2010-08-05
how do i decide which to use: cast() or convert() in t-SQL
0
Comment
Question by:vinny45
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
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…

690 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