massoud-1045248 (1/29/2015)
Hello Solomon, thanks for your reply. It's been a while but I use this code to compute a median for a list that varies every day.so basically date(T), median(list(T)).
meaning : 01/02/2015 Median (list), 01/03/2015 Median (list) ....
I think my work around was to exclude some dates and move on when it wasn't working. Now when I go and compute without the time series and look at a specific date , it works .
Hi again. So, if I am understanding you correctly, you are doing a MEDIAN of a list of DATETIME (or just DATE) instead of FLOAT? I had never considered such a thing. Interesting. But I can see one immediate problem: what to do in the case of an even list, since DATE / DATETIME values cannot be averaged. I suppose you could just pick the higher or lower value in each case, or in SQL Server 2008 and newer, pass in a second parameter to determine which side to err on.
If you want to continue debugging this, since it really isn't the code from the article, please post a message to the CLR Integration and Programming forum and we can take it from there.
Take care,
Solomon..
SQL# — https://SQLsharp.com/ ( SQLCLR library ofover 340 Functions and Procedures)
Sql Quantum Lift — https://SqlQuantumLift.com/ ( company )
Sql Quantum Leap — https://SqlQuantumLeap.com/ ( blog )
Info sites — Collations • Module Signing • SQLCLR