.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Invalid Floating Point operation when used with group by

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :Sql Server


This is related to a question I asked in the forum before and it looks like it is not handling the negative numbers within the log expression. Please let me know.



declare @insurance table


groupid int,

classid varchar(20),

creditamt varchar(20),

debitamt varchar(20),

insuraceflag varchar(30)




 ;with cte as


select groupid,classid,creditamt,debitamt,ROW_NUMBER() over (partition by GroupId order by ClassId ) as rn from @insurance


 cte1 as


select t.GroupId,t.debitamt,t1.Amt from 

(select * from cte where rn = 1)t

inner join (select GroupId,exp(SUM(LOG(CAST(isnull(creditamt,debitamt) as decimal(8,4))) )) as Amt from cte where rn <> 1 group by GroupID)t1 on t.GroupID = t1.GroupID


 select * from cte1 -- this bombs when the inside log expression is NEGATIVE or ZERO.


View Complete Post

More Related Resource Links

An invalid floating point operation occurred


why do i get an error while running this command

select (POWER((0.1935 /-0.0972 ),0.5) - 1 )

and what is the solution for this

Why is ParseXPathExpression throwing a Floating-point invalid operation? (re: WinDbg)


I'm a software developer working for the federal government and we use a third party product that we are suddenly having problems with.  The product worked perfect on Friday but after the weekend it no longer works.  (ie. the application/process starts but nothing appears on screen and it appears to hang, etc)

I've never really used WinDbg but I'm trying to learn but looks like MS.Internal.Xml.XPath.XPathParser.ParseXPathExpresion is throwing a Floating-point invalid operation exception.  (0xc0000090)

I've stepped through the code (with WinDbg) and here is the managed stack trace when the exception is first thrown:

001EF98C 01D3BD83 System_Xml!MS.Internal.Xml.XPath.XPathParser.ParseXPathExpresion(System.String)+0x23
001EF9A0 01D3B301 System_Xml!MS.Internal.Xml.XPath.QueryBuilder.Build(System.String, Boolean, Boolean)+0x21
001EF9B8 01D3B2B7 System_Xml!MS.Internal.Xml.XPath.QueryBuilder.Build(System.String, Boolean ByRef)+0xf
001EF9C4 01D3B24A System_Xml!System.Xml.XPath.XPathExpression.Compile(System.String, System.Xml.IXmlNamespaceResolver)+0x2a
001EF9E0 01D3B200 System_Xml!System.Xml.XPath.XPathNavigator.Select(System.String)+0x10
001EF9EC 01D3AED2 System_Xml!System.Xml.XmlNode.SelectNodes(System.String)+0x32
001EFA00 01D309C4 TiS_TisCommon!TiS.TisCommon.Configuration.BaseConfigStorage.LoadConfigSections()&#

User group invalid for new document



Defined a user group and a site column of type people/group directing to this group.

Also defined a content type and added the site column to this content type.

When I create a new word document of this content type, word opens displaying my site column ok. But when I enter it, I see that all active directory (AD) entries are displayed. I want it to display only those users I added to the user group I created. Moreover, users can select any user from AD, which makes defining a user group and a site column meaningless.

This problem is only in creating new documents with Word. If I edit properties of an already existing document in my site, everything is ok: I can select only the users in the group.


An exception occurred during the operation, making the result invalid

Hi I am using WCF services with WPF, both are .net 4 versions. I am calling asynchronously, During method calls, sometimes I get the following error Void RaiseExceptionIfNecessary()---An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() I tried alot to find the reason , but unable to find as it is unpredictable and inconsistent. Seeking for kind help from WCF guruzzz... Regards Zee

processing measure group : memory error : the operation cannot be completed because the memory quota

Hi, I'm stucked with this problem. Untill last week, the cube processed without any problem. Since last week, I'm getting this error. I have been searching in different forums, and I tried some suggestions, like changing memory limit properties, ... It is getting worse.. So I reset all properties to default again. I am running SQL-Server + MS-AS 2005 SP2 on server with 4GB of memory. This is a dedicated server, nothing else is running on it. The fact table has +/- 14 million records, several dimensions en 2 measure groups. I don't have problems to process the dimensions, but when I try to process the cube or the measure groups of that cube separately , the error persists. I have changed the datasource view, and replaced the fact table by a Named query. Even when I put a 'WHERE datapart( year , fact_date ) >= 2009 ' clause to reduce the number of records to +/- 5 million, I'm still getting the error. I don't understand what is wrong, the cube always processed since +/- 2 years. As I said, I have found a lot of this kind of Issues on different websites, I have been trying to change some properties. But this still does not solve the problem. Could it be that MS-AS settings are corrupt somewhere ? Is it a good idea to re-install MS-AS 2005 + SP1 + SP2 ? Or is there another reason possible ? I really appreciate any kind of help, because I'm

String.Format rounding down floating point number


Hi, I'm having an issue with String.Format, can somebody tell me if it's something I'm doing.


I'm using C# 2.0 I have code which looks a little bit like this:


Code Snippet

string result;

float floatToConvert = 10780503.000000f;


result = String.Format("{0:0,0}",floatToConvert);



Now I would expect result to have a value of "10,780,503" after this line of code, but it doesn't it has a value of "10,780,500"...


If however I do this:


Code Snippet

string result;

float floatToConvert = 10780503.000000f;

Sharepoint 2010 Configuration Wizard Failed- Invalid Operation was thrown



I installed SharePoint 2010 Standard on a Server with Windows 2008 Service Standard SP2 64bit OS. When I run the Configuraton Wizard it fails and the following message appears:

An exception of type System.Invalid OperationException was Thrown.Additional exception information: Cannot start service c2wts on computer.

the details are:

System.InvalidOperationException: Cannot start service c2wts on computer '.'. ---> System.ComponentModel.Win32Exception: The service did not respond to the start or control request in a timely fashion
   --- End of inner exception stack trace ---
   at System.ServiceProcess.ServiceController.Start(String[] args)
   at Microsoft.SharePoint.Win32.SPAdvApi32.StartService(String strServiceName)
   at Microsoft.SharePoint.Administration.SPWindowsServiceInstance.Start()
   at Microsoft.SharePoint.Administration.SPWindowsServiceInstance.Provision(Boolean start)
   at Microsoft.SharePoint.Administration.Claims.SPWindowsTokenServiceInstance.Provision()
   at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.InstallServiceInstanceInConfigDB(Boolean provisionTheServiceInstanceToo, String serviceInstanceRegistryKeyName, Object sharepointServiceObject)
   at Microsoft.SharePoint.PostSetupConfigur

Quad-precision floating point in .NET?

When does Microsoft plan to add quad-precision floating support to its .NET CTS data types (such as IEEE 754 binary128)? I.e. when is it going to become available to .NET C#, C++, etc.? I have published a WP7 calculator app, and I am currently working on an enhanced scientific mode in landscape display. Currently, the only available floating point is float and double; hence, I have a maximum of 15 digits precision available using double.

While double precision (theoretically) is all anyone ever needs, in a competitive sense, that's not true. Microsoft supports 32 significant digits in the scientific mode of its Windows calculator, presumably because it's written using the unmanaged C++ quad-precision library. More importantly, other competitive platforms support more than double precision.  Rgardless of any theoretical arguments about how someone may never need to use more than double precision, if quad precision is supported elsewhere, for practical, competitive-product reasons .NET should support it too for WP7 apps.

The Decimal structure is not adequate for many reasons:

- Decimal was intended only for financial calculations where a loss of precision during rounding operations is unacceptable.
- Decimal is much (much) slower than double for most operations, primarily because double operations are done in binary,

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

learn basic about share point.

This learn basic about share point.

Group Calendars in SharePoint 2010

One of the many requests I had in SharePoint 2007 was the ability to place SharePoint Calendars on top of each other like you can in Outlook 2007 saving you having to look at each and work out when the best time is for a meeting.

how to set break point at inline code

I set the element height value by using inline code 
<%# Eval("s") %>
where "s" is the variable declared in page load event. when i run the application it don't set the height. 
Is there any way, i can set break point into .aspx file. i mean how i can check if my Eval("s") get the value.  

ListViewControl - how to group items by their value, for eg. date range



I have a table containing courses, columns are 

Name - "Yoga Classes"

DateStart - "2/23/2010"

DateEnd - "2/24/2010"

I am using ListView Control to bind it, is there a way to display them and group them by Month? 

for eg.


Piano Class (10th Jan 2010 - 11th Jan 2010)
Guitar Class (10th Jan 2010 - 11th Jan 2010)


Yoga Class (15th Feb 2010 - 16th Feb 2010)

Thanks for help.

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is no



 I keep getting the following error. I also added time out parameter in the connection stirng and it still did not help. Has any one faced similar issues.

Thanks in adavance.

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.]

How do I get the emails of all the members of a given group in ActiveDirectory - Need help



  I have a need to send out emails to all the people who are in a given group say "HR Department". I need to be able to get all the emails through a for loop and then as it retrieves I should send emails to them. Can some one please help me with the code

this is what I came up with but not sure how to go about writing a for loop to get all the emails in the given group.

public static string SendEmails(string loginName)
        string Department = "HR Department"
        string userName = ExtractUserName(loginName);
        DirectorySearcher search = new DirectorySearcher();
        search.Filter = String.Format("(SAMAccountName={0})", userName);
        //search.Filter = String.Format("(SAMAccountName={FAY ImprovmentForm})", userName);
        //LdapSearcher.Filter = string.Format("(&(objectClass=user)(department={0}))", Department); 
        //search.Filter = string.Format("(&(objectClass=group)(SAMAccountName=" + Department + "))", userName);

A lengthy operation in an ASP.NET web service


I've built an ASP.NET web service with .NET 2.0 (an asmx file). I invoke a web service method using Ajax. The method takes a substantial amount of time to execute (5 minutes to 1 hour). I believe it's not a good idea to "hang" the web request for so long.
I'm wondering if the web service method could spawn an additional process which in turn would execute the lengthy operation and notify the web service once the operation is completed.
Are there any good practices regarding this kind of functionality?


ToggleDebugCompilation fails trying to perform "an unauthorised operation"



We're having a problem with the Visual Studio 2008 RTW version of the web deployment projects on a colleagues machine. The project works fine if I run it on my machine, but when he tries to run it on his machine he gets:

<SNIP : Most output removed>
  Task "Exec"
    if exist ".\TempBuildDir\" rd /s /q ".\TempBuildDir\"
  Done executing task "Exec".
  Using "ToggleDebugCompilation" task from assembly "C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.Tasks.dll".
  Task "ToggleDebugCompilation"
    Updating Web.config <compilation> element debug attribute to 'True'.
    C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets(639,7): error : Attempted to perform an unauthorized operation.
    C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets(639,7): error MSB4018: The "ToggleDebugCompilation" task failed unexpectedly.
    C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets(639,7): error MSB4018: System.ArgumentNullException: Parameter "message" cannot be null.
    C:\Program Files\MSBuild\Microsoft\WebDeployment
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend