question

sql formula from xls

Dears, I have to convert a xls formula to sql, but Im havinfg some problems with power function, can anyone help me on that, the formula looks as below: (AX10+AY10)/(SQRT((AX10+AY10)^2+(AZ10+BA10)^2))) I tried in this way but it wont work.. (([fld1]+[fld2])/(SQRT(([fld1]+[fld2])POWER(2)+[fld3]+[fld4])power(2)))) I appreciate your help, Thank you in advanced
1 comment

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

·
In what way does it not work? Does it give you an incorrect answer, or is it erroring?
0 Likes 0 ·

·
`POWER()` function requires 2 arguments, so I think you want (([fld1]+[fld2])/(SQRT(POWER(([fld1]+[fld2]),2)+power(([fld3]+[fld4]),2))))
1 comment

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

·
Thanks a lot Kev..:), this is what I needed
0 Likes 0 ·
The POWER function takes two arguments - http://msdn.microsoft.com/en-US/library/ms174276(v=SQL.90).aspx DECLARE @value int, @counter int SET @value = 2 SET @counter = 1 WHILE @counter < 5 BEGIN SELECT POWER(@value, @counter) SET NOCOUNT ON SET @counter = @counter + 1 SET NOCOUNT OFF END GO returns 2 4 8 16

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.