Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to move code across from my Perl program over to MS SQL Server. But the following TSQL code:
SELECT SUM(A.Person_count/(B.Person_count*E.Number_of_years)/A.Total_pop*C.Pe +rson_count))*1+(sqrt((SUM((A.Person_count/(B.Person_count*E.Number_of +_years)/A.Total_pop)*(A.Person_count/(B.Person_count*E.Number_of_year +s)/A.Total_pop)*C.Person_count))/(SUM(C.Person_count)))*(((SUM(C.Pers +on_count)+1))*(1-1/(9*((SUM(C.Person_count)+1)))+1.96/(3*sqrt((SUM(C. +Person_count)+1))))^3-(SUM(C.Person_count))))*1 FROM ************ A, ****************** B, ************** C, * +************ E
Gives me the error message:
Invalid operator for data type. Operator equals boolean XOR, type equa +ls float.
Can anyone please point out the problem with this?

2004-10-28 Edited by Arunbear: Changed title from 'Invalid operator for data type', as per Monastery guidelines

Replies are listed 'Best First'.
Re: (OT) MS-SQL error: 'Invalid operator for data type'
by gellyfish (Monsignor) on Oct 27, 2004 at 13:44 UTC

    It is the ^3 you have to use the POWER function instead.

    /J\

      I am a bit confused about how I would implement POWER(). Time for me to head to the microsoft page I think.

        Assuming I counted parens correctly, then:

        (1-1/(9*((SUM(C.Person_count)+1)))+1.96/(3*sqrt((SUM(C.Person_count)+1 +))))^3

        becomes:

        POWER((1-1/(9*((SUM(C.Person_count)+1)))+1.96/(3*sqrt((SUM(C.Person_co +unt)+1)))),3)

        HTH

        --
        edan