Viewing 4 posts - 1 through 4 (of 4 total)
I needed this great script just today. Thanks.
January 19, 2016 at 3:27 am
Finding meadian value of field Number in table SampleData
DECLARE@Median FLOAT;
SELECT@Median = ISNULL(AVG([Number]), 1)
FROM(
SELECT[Number],
ROW_NUMBER() OVER ( ORDER BY [Number] ASC ) AS [NumberRank],
(
SELECTCOUNT(*)
FROM[SampleData]
) AS [NumberCount]
...
December 9, 2013 at 2:13 am
Just right. Thanks as lot.
Maybe also to add
USE master
GO
first, as your current database might not be in the required compatibility mode 😉
-
Regards
Flemming Hansen
August 5, 2011 at 12:20 am
Msg 102, Level 15, State 1, Line 33
Incorrect syntax near 'dec'.:hehe:
August 4, 2011 at 12:16 am
Viewing 4 posts - 1 through 4 (of 4 total)