when to use cast or convert in sql server [Resolved]

Posted by Jitendrasoft09 under Sql Server on 6/26/2013 | Points: 10 | Views : 872 | Status : [Member] [MVP] | Replies : 3
Hi All,
I want to understand when to use cast or convert in sql server, let me know if anybody knows

Jitendra Kumar
If my post helps you, plz mark as an answer.



Responses

Posted by: Niladri.Biswas on: 6/26/2013 [Member] Platinum | Points: 50

Up
0
Down

Resolved
CONVERT is SQL Server specific, CAST is ANSI.

CONVERT is more flexible in that you can format dates etc. Other than that, they are pretty much the same. If you don't care about the extended features, use CAST.

Source: http://stackoverflow.com/questions/707335/t-sql-cast-versus-convert

Best Regards,
Niladri Biswas

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 6/27/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
http://msdn.microsoft.com/en-us/library/ms187928.aspx

If this post helps you mark it as answer
Thanks

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jitendrasoft09 on: 6/27/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
good effort Satya..., nice explanation Niladri...

Jitendra Kumar
If my post helps you, plz mark as an answer.

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response