Problem in SSMS and BIDS with STDEVP function query being changed by tool

I previously asked this question in Transact SQL forum but I think I'm dealing with a tool related problem and not with a Transact SQL problem.

I am currently unable to get the stdevp function to work when I am using the SQL pane of either SSMS or BIDS for SQL 2005 standard edition. The query is as follows:

SELECT stdevp(Schedule_Weight) AS Expr1
FROM Order_Start_Steps_Weights
WHERE (Schedule_Weight_Type = 1)

When I try to execute the query (from either BIDS or SSMS sql pane by clicking on the ! icon) the query spontaneously changes to:

SELECT COUNT_BIG(Schedule_Weight) AS Expr1
FROM Order_Start_Steps_Weights
WHERE (Schedule_Weight_Type = 1)

I should mention that the query does not get changed if I use the stdev function instead of the stdevp function. Also, it returns the count as the result of the query in the results pane when I try to execute the stdevp function but it returns the standard deviation if I use stdev instead of stdevp.

Needless to say, there is a big difference between counting a population and finding the standard deviation of a population.

Have I hit a bug in these two tools Thanks in advance.

Steve Wells




Answer this question

Problem in SSMS and BIDS with STDEVP function query being changed by tool

  • chuckmed

    Thanks for the answer. The work around will do the trick so not a big deal to wait for the fix.

    Believe it or not, my code occasionally has bugs too.

    Steve Wells



  • CosmoTopper777

    Yes, Steve, you hit a bug in both tools and it is a dosey! Not only that the same problem exists in Visual Studio 2005.

    I am really sorry you had to encounter this problem.

    Until we get this fixed you can work around the problem with

    SELECT SQRT(VARP(Schedule_Weight)) AS Expr1
    FROM Order_Start_Steps_Weights
    WHERE (Schedule_Weight_Type = 1)

    I checked the math on this and also verified it emperically.

    Casey



  • Problem in SSMS and BIDS with STDEVP function query being changed by tool