Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to create median function?



How to create median function?..

Answer / Gourav Kumar Rastogi

In SQL Server Reporting Services, you can create a median function by using a windowed function like MEDIAN. However, MEDIAN is not supported in all SQL Server versions. As an alternative, you can write your own median function as follows:n`nCREATE FUNCTION dbo.Median (@pData FLOAT) nRETURNS FLOAT AS BEGIN nDECLARE @count INT = (SELECT COUNT(*) FROM @pData) nORDER BY pData nSET @pData = (SELECT TOP ((@count + 1) / 2) pData FROM @pData WHERE ORDER BY pData > @counter) nIF (@count % 2 = 0) nBEGIN n SET @pData = (@pData + (SELECT TOP 1 pData FROM @pData WHERE ORDER BY pData < @counter)) / 2 nEND nRETURN @pData nENDn

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SSRS SQL Server Reporting Services Interview Questions

Would you store your query in a ssrs report or a database server? State the reason why?

1 Answers  


What is report server project?

1 Answers  


When to use null data driven subscription?

1 Answers  


What are parameterized reports?

1 Answers  


How to create “dependant” parameter “make, model, year”

1 Answers  


What are the export options of ssrs?

1 Answers  


What is the report builder?

1 Answers  


What is the report model project?

1 Answers  


Explain can you implement data mining in ssrs?

1 Answers  


How do users use Report Builder with SQL Server data sources?

1 Answers  


What are drillthrough reports?

1 Answers  


What is rs.exe utility?

1 Answers  


Categories
  • SSRS SQL Server Reporting Services Interview Questions SSRS SQL Server Reporting Services (140)
  • Microsoft Azure SQL Interview Questions Microsoft Azure SQL (73)