Declare @MaxValue int Select @MaxValue=(case when @MaxValue>marks then @MaxValue else marks end) From [stud].[dbo].[Stud] Select @MaxValue
id marks 1 100 2 200 3 300 4 50
SELECT MAX(marks) FROM MyTable
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)