What will happen if we execute below Sql Statement?

Declare @value int = '10,20';
Select @value as output

 Posted by vishalneeraj-24503 on 7/2/2014 | Category: Sql Server Interview questions | Views: 1944 | Points: 40

If we execute above statement,then we will get following error:-

Msg 245, Level 16, State 1, Line 1

Conversion failed when converting the varchar value '10,20' to data type int.

Above statement states that we can not store any datatype value or character other than numeric value in Int Datatype.
Or can not convert varchar value which contains comma or special characters into Integer.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response