What will happen when we execute below query?

select avg('123')
select avg('rajesh')

 Posted by Rajesh_Kumar on 1/22/2014 | Category: Sql Server Interview questions | Views: 5577 | Points: 40
Answer:

It will give us below error which says as
Msg 8117, Level 16, State 1, Line 1
Operand data type varchar is invalid for avg operator.


As we know that Avg as name suggests will only apply on integer column,if we supply other than numeric value then it will throw above error.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response