|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Saturday, April 16, 2011 10:29 AM
Points: 502,
Visits: 399
|
|
I figured the answer was going to be something related to CONVERT having the style parameter (and hence more capabilities), but then saw in BOL (2005) that "CAST and CONVERT provide similar functionality" so chose the last answer.. doh! Should have gone with gut feeling but have been tricked too many times from previous questions which always give the BOL answer as the correct one (even if it isn't). Although I see now that BOL for 2008 does not have that statement in it.
Just can't win....
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 5:42 AM
Points: 3,189,
Visits: 4,146
|
|
erwin.oosterhoorn (3/8/2010)
bouarroudj Mohamed (3/8/2010) CONVERT works across all platforms & has more capabilities in SQL Server is also trueThat is what I am looking at as well, does this not mean the same as the given right answer? If one has less the other must have more? I agree with this. The phrasing of the answers seems quite ambiguous to me.
"CAST ... has less capabilities in SQL Server" – according to what? According to "CAST in another RDBMS", according to "CAST in SQL-92", or according to "CONVERT in MSSQL/another RDBMS"?
KevinC. (3/8/2010)
If I understand correctly, CONVERT is MS SQL specific whereas CAST is ANSI-SQL and will work on multiple platforms (i.e. Oracle, DB2, etc.). Therefore, the above statement is incorrect because CONVERT does NOT work across all platforms (though it does have more capabilities in SQL Server). Please correct me if I'm wrong.  CONVERT is not MSSQL specific, it also works on Sybase ASA/ASE. Also CONVERT exists in SQL-92, but has different meaning (see below).
I had checked documentation on several RDBMS platforms (MSSQL, Sybase, Oracle, DB2, PostgreSQL, MySQL) before I answered the question, here is the result: – CAST works across all these platforms, and may have additional MULTISET parameter in Oracle; – CONVERT works across all platforms, but has two different meanings. In MSSQL/Sybase it converts data from one type to another, in other databases it converts text data from one encoding to another (therefore working like COLLATE clause in MSSQL), as described in SQL-92.
Also I found an issue in the QOD explanation:
agrawal.prakriti CAST is the more ANSI-standard of the two functions, meaning that while it's more portable This sentence is somewhat incomplete, isn't it? (although I'm a total noob at English language )
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 9:23 AM
Points: 1,288,
Visits: 2,996
|
|
bouarroudj Mohamed (3/8/2010) CONVERT works across all platforms & has more capabilities in SQL Server is also true
My thinking exactly and that was my answer too, which I got wrong. Question was a little confusing and nebulous..
"Technology is a weird thing. It brings you great gifts with one hand, and it stabs you in the back with the other. ... "
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 7:18 PM
Points: 10,989,
Visits: 10,532
|
|
Can anyone else hear that high-pitched whining sound in here?
Paul White SQL Server MVP SQLblog.com @SQL_Kiwi
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 5:42 AM
Points: 3,189,
Visits: 4,146
|
|
sknox (3/8/2010) I'm quite surprised that, at the time I answered the question, approximately 3/4 of people got this question wrong. Do you think this is because lack of knowledge? I think many people answered "incorrect" because of the phrasing.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 5:48 PM
Points: 7,088,
Visits: 7,143
|
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Tuesday, February 19, 2013 9:08 AM
Points: 1,511,
Visits: 81
|
|
this question is ambiguous, both answers 2 and 4 are almost the same
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Friday, February 04, 2011 7:20 AM
Points: 977,
Visits: 1,499
|
|
jmatayoshi (3/11/2010) this question is ambiguous, both answers 2 and 4 are almost the same
So Almost the Same = Ambiguous?
What if they were Somewhat Different? Would that be better?
Tom Garth Vertical Solutions
"There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 7:18 PM
Points: 10,989,
Visits: 10,532
|
|
jmatayoshi (3/11/2010) both answers 2 and 4 are almost the same That statement makes my head spin.
Paul White SQL Server MVP SQLblog.com @SQL_Kiwi
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Yesterday @ 1:07 PM
Points: 18,733,
Visits: 12,332
|
|
|
|
|