Hi,
I have a table with some integer values.
i want to calculate the maximum/minimum of each row and the column name which contributes it.
exampl
create table #tmp(v1 int,v2 int,v3 int,max1 int, colmax)
i want to calculate the maximum among v1, v2 and v3 and whether v1 contributes or v2 contributes or v3 contributes the maximum value.
if v1 -20
v2 -30
v3 -50
then
max1 will be 50
colmax will be v3
how can i achieve this in sql server 2005
thanks,
regards
viji