It will give us error saying that:-
Msg 108, Level 16, State 1, Line 1
The ORDER BY position number 3 is out of range of the number of items in the select list.
Meaning that as we know that we can also access column by their's index position.So here Index 1 is Id column,index 2 is Name column but in order by clause we have passed 3 that is also an index position,but in select statement there are only 2 columns.That's why it will give an error.So to overcome this error,we have to pass number of column index as specified in select list.
Asked In: Many Interviews |