Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Question of the month November 2014 - What is the result of CAST(1001 as CHAR(3))?

Nov 30 2014 12:00AM by Madhivanan   

The following returns the result as 100

SELECT CAST('1001' as CHAR(3))
Now, what is the result of the following statement?
SELECT CAST(1001 as CHAR(3))

Tags: 


Madhivanan
2 · 40% · 13039
3
 
0
Lifesaver
 
0
Refreshed
 
 
0
Incorrect



Submit

1  Comments  

  • Madhivanan, Not sure, but think that this is done to preserve the value where digit loss can be a significant data change specially in case of some critical measurement or money.

    Also, interesting thing to lookout for is this behavior

    SELECT CAST(1001 as VARCHAR(3)) -- produces *
    SELECT CAST(1001 as NVARCHAR(3)) -- Arithmetic overflow exception of level 16
    

    Think that this inconsistency exists due to the different timeframe when datatype added to SQL Server, but not really sure. Will be glad to know if there is another reason for this behavior.

    Thanks for this nice puzzle where I leaned something new today.

    commented on Dec 1 2014 12:43AM
    Chintak Chhapia
    40 · 5% · 1477

Your Comment


Sign Up or Login to post a comment.

"Question of the month November 2014 - What is the result of CAST(1001 as CHAR(3))?" rated 5 out of 5 by 3 readers
Question of the month November 2014 - What is the result of CAST(1001 as CHAR(3))? , 5.0 out of 5 based on 3 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]