I am creating function to get the percentiles in a given column
So , it's necessary to pass a tablename and columnname to the function
the following function is working fine.
But , I want to modify it to pass the columnname as totaltime and tablename as a
CREATE function percentile ( @shortname nvarchar(255) )
returns float as
begin
return (select max(totaltime) from a where row_id in
(select top 90 percent C.row_id from a C where C.shortname
like @shortname order by C.totaltime )
and shortname like @shortname )
end
HOW DO I DO THIS??
So , it's necessary to pass a tablename and columnname to the function
the following function is working fine.
But , I want to modify it to pass the columnname as totaltime and tablename as a
CREATE function percentile ( @shortname nvarchar(255) )
returns float as
begin
return (select max(totaltime) from a where row_id in
(select top 90 percent C.row_id from a C where C.shortname
like @shortname order by C.totaltime )
and shortname like @shortname )
end
HOW DO I DO THIS??
Comment