Character
|
CAST
|
CONVERT
|
1. Type
|
CAST is ANSI.
|
CONVERT is SQL Server specific
|
2. Date values
|
Cast don’t has different types date formats.
|
You can apply Different styles for date values. Like 108, 98, 101…
etc styles.
|
3. Syntax
|
Syntax
for CAST:
CAST
( expression AS data_type [ ( length ) ] )
|
Syntax for CONVERT:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )
|
4. For Decimal Results
|
Use CAST
|
|
5. For Truncate purpose
|
CAST to truncate
|
|
6. For Quick Search
|
CAST
for quicker search
|
|
|
|
|
Similarities:
Variants
|
CAST and CONVERT variants -- always
|
Concatenate
|
CAST and CONVERT to concatenate
|
- Cast
1.
Cast
is ANSII Standard
2.
Cast
cannot be used for Formatting Purposes.
3.
Cast
cannot convert a datetime to specific format
- Convert
1.
Convert
is Specific to SQL SERVER
2.
Convert
can be used for Formatting Purposes.For example Select convert (varchar,
datetime, 101)
3.
Convert
can be used to convert a datetime to specific format
Useful Link:
Wow its a very good post. The information provided by you is really very good and helpful for me. Keep sharing good information.
ReplyDeleteSoftware Testing Services
Functional Testing Services
Test Automation Services
QA Automation Testing Services
Regression Testing Services
API Testing Services
Compatibility Testing Services
Performance Testing Services
Security Testing Services
Software Testing Company
Software Testing Services in USA
Software Testing Companies in USA