.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

Stupid developer tricks - When a data type overflow doesn't cause an overflow

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :Sql Server
Build a very basic cube that has a dimension with a hierarchy and a single measure.  For example, a time dimension with Year, Quarter, Month, Date along with a quantity sold.  The quantity sold is an integer in your database. Now, load up your database with test data such that the quantity when rolled up to a quarter level will be just less than the maximum value for an integer.  Process your cube and see the absolutely stupid value that gets displayed for a year. For those of you reading along and not wanting to build a cube to see what happens, here it is in a nutshell. To make the math simple, we'll use 2 billion as the max value for an int and -2 billion and the min value.  Say for example that the quantity sold for each quarter was 1 billion units.  When you look at the cube from the quarter on down, you see nice, neat POSITIVE values.  But, when you look at the quantity sold for the year, SSAS reports the quantity sold as 0. No, it didn't substitute 0 for a data type overflow (4 billion exceeds the 2 billion max).  Instead, the developer of this "feature" decided that it would be a really nice idea to just ignore the fact that you had a data type overflow and just treat the range of values as a looping structure.  So, his code said, take the aggregated value, run it all the way up to the last value in the range and tak

View Complete Post

More Related Resource Links

Errors in the back-end database access module. OLE DB reported an overflow of the data type for colu

Getting an error when processing a dimension, Errors in the back-end database access module. OLE DB reported an overflow of the data type for column 0. Errors in the OLAP storage engine: An error occurred while the 'xxxxxx' attribute of the 'Dim XXXXXX' dimension from the 'XXXXXXX' database was being processed. Content of this dimension is very similar to one that is processing no problem. The content of the dimension is one field only of type date.  The original content was imported through SSIS from a DB2 database on an iseries machine.  Thought a first the issue was because of the data contains some null values but the dimension the process OK also has some null  values.  The dimension that processes ok is also a single field of type date. Any help greatly appreciated, Roscoe

Arithmetic overflow error converting expression to data type smallint

Can anyone tell me what exactly this means? Arithmetic overflow error converting expression to data type smallint. 

Arithmetic overflow error converting expression to data type int.


I have a table with a row called row1, this row1 is a bigint and has values from 0  To  4278190080


I am running a query such as: select top 1 * from tableA where row1 <= (((73*256+62)*256+53)*256 + 12)


How can I get this to work? I tried to do where cast(row1 as float) <= ....... but I get the same error.

show data in grid view error Arithmetic operation resulted in an overflow.



i have a table there is 17 columns in 17 column 3 are number and other are varchar . when i try to display all data of that column error occures.

one more intersting think is when i try to display 6 column then grid show there data an no more error occures. 

when i run my project this error occures in grid view

Arithmetic operation resulted in an overflow. 

View data type doesn't reflect table


I'm not sure if this is the place for this question, but here goes.

I am running SQL Server 2005, and I've encountered an issue with view data types.  I had a client who asked if they could allow for decimals in a field that was previously an integer.  This meant going and changing the column data type on a few tables from integer to float, and changing some parameters and variables within some stored procs/functions to floats.  Somewhere the value is still being rounded down, so I queried the information_schema.columns and found about 60 views in the system that reference that column and are still being considered an int, from the tables which were already converted to float.  I've found that if I simply script the views as alter and run it the column no longer is considered an int in the information schema.

My question is this: Does this seem to be my problem, that when the view is referenced the value is changed to an int? Or does the view simply reflect the table's data type and the information schema is incorrect?  If the former, is there a faster way to update all these views without going one by one and scripting them? Thanks in advance.

The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must



This is frustrating, and I don't know how to solve it.

I have a strange problem. I am adding a LinqDatasource object, and set the context:

        protected void LinqDataSource_ContextCreating(object sender, LinqDataSourceContextEventArgs e)
            e.ObjectInstance = new KaruselaDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

Then I get this error:
The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.


On web.config I already have this:
<add assembly="System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

NOTE: The datacontext is in a different project (DLL proect) where I added a refernce to System.Data.Linq.

is there another way adding a refernce to a web project? or only though teh web.config?


Flex Your Data: Teach Old Data New Tricks with the Fully Loaded Advances in ADO.NET 2.0


ADO.NET 2.0 will streamline your data access development efforts. Its new features let you work better with XML and SQL Server, and they offer lots of other improvements as well. This article takes a detailed look at some of the more interesting enhancements and focuses on performance and flexibility.

Julia Lerman

MSDN Magazine April 2005

XML in Yukon: New Version Showcases Native XML Type and Advanced Data Handling


The next version of Microsoft SQL Server, code-named "Yukon," represents quite a few steps forward in the evolution of XML integration. Yukon supports native storage of XML data using the XML data type, which makes it possible to run native queries on XML data using the emerging industry standard XQuery language. Data integrity of the XML data type can be enforced through schema validation and XML-based check constraints, and special indexes can be defined that help speed up queries. In addition, Yukon has the built-in ability to expose its data through Web services. This article discusses these and other XML features of Yukon.

Bob Beauchemin

MSDN Magazine February 2004

override error message (The value 'test' is not valid for Age) when input incorrect data type for in


Hello everyone,

I've tried to override error message when input incorrect data type in input field on HTML form. For example I have the model like this.

public class Person
public string FirstName {get;set;}
public int Age {get;set;}


For view, I put text input for Age to get it value.

When type some string in Age text box like 'test' and press submit button. I got this error message

The value 'xxx' is not valid for Age

However, I want to change this message and try many way. There 's nothing effect this message value.

Please could you help me to solve this problem.

Overflow when image not present



I have the following on an image so that i can load :


The function is:

function Repl_img(sender)
           // you may need to comment this out if no images are reachable
                sender.src = "dir/NoImage.jpg";

When i run on a machien which doesn't have the noimage present i receive a stack overflow at line 0

I've put the try catch around it and still receive this.

I'm wondering if i have the try catch correct or i need something else to fix?

Error converting data type varchar to numeric.


I create a form to record data using ASP.NET and SQL database...
when i run the project show error "Error converting data type varchar to numeric"

what's the problem actually.i try to change in datatype in database..
but still showing error...


When I use 'publish', site doesn't work when i post data


Arrgghh, I am so tired of dealing with stuff like this

I've got a project, when I put up on another server I point two sites in IIS6 to it

i have

http://www.main.com  pointing to the folder the files are in


http://www.anotherofoursites.com/main pointing to that same folder in it's own "Virtual Application" or whatever IIS calls it when you put a folder into it's own 

If I just "Build" and push all the files up.. both work without issue and as expected...  but when I use "Publish" to precompile, the site works until I post, and then i get nailed with:

Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

WSS 3.0 Content Type - Lost data for Titles


We are running WSS 3.0 SP2 on server 2003.  Recently, we lost the "Titles" for all content types for documents.  Our system Content Type for Document is set up to require this field to be completed on all documents that is uploaded.  Our system would automatically enter in by default the name of the document in the "Title" field it no longer does this for the user.  The user must now enter in manually the "Title".  How do I get it to enter in the "Title" using the document file name automatically?

Below is the way the setting page for Site Content Type: Document looks like.  (I tried to recreate it since I could place a screen shot in the box)

Site Content Type Information
Name:  Document
Descriptiong:  Create a new document.
Parent:  Item
Group:   Document Content Types

Name, Description, and group
Advanced settings
Workflow settings
Delete this site content type

Name                 Type                     &nb

chnage data of input type with readonly attribute


I have webform where i have different input type as text controls with a readonly attribute. I have option to edit the data so through javascript i remove the readonly attribute through javascript, here's the code 
function EditBillAddress()

Developer Training: Data Access in Technologies in SharePoint 2010

Learn about the new data access technologies in SharePoint 2010 and how they can help increase your productivity. This training module covers the basics of LINQ handling and how to use the Client OM and REST to access SharePoint 2010 information remotely.

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlCli

I have created a windows library control that accesses a local sql database I tried the following strings for connecting Dim connectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=TimeSheet;Trusted_Connection = true" Dim connectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=TimeSheet;Integrated Security=SSPI"   I am not running the webpage in a virtual directory but in C:\Inetpub\wwwroot\usercontrol and I have a simple index.html that tries to read from an sql db but throws the error System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.   at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)   at System.Security.PermissionSet.Demand()   at System.Data.Common.DbConnectionOptions.DemandPermission()   at System.Data.SqlClient.SqlConnection.PermissionDemand()   at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, etc etc  The action that failed was:DemandThe type of the first permission that failed was:System.Data.SqlClient.SqlClientPermissionThe Zone of the assembly that fa

Conversion Failed when Converting the nvarchar value 'N' to data type int.

Hi.. I am facing a strange situation. when i executing the following query it is returning the error SELECT  s.row_id as shipment,    SUM(CAST(la5.attr_value AS INT)) AS Cases     FROM    shipment s WITH(NOLOCK)    INNER JOIN shipping_shift ss WITH(NOLOCK) ON s.shipping_shift = ss.row_id    INNER JOIN shift WITH(NOLOCK) ON ss.shift_id = shift.shift_id    INNER JOIN shipment_lot sl WITH(NOLOCK) ON s.po_id = sl.po_id AND s.cust_id = sl.cust_id AND          s.so_line_no = sl.so_line_no and s.ship_date_local = sl.ship_date_local     INNER JOIN lot_attr la5 WITH(NOLOCK) ON sl.lot_no = la5.lot_no AND sl.item_id = la5.item_id AND la5.attr_id = (SELECT attr_id FROM attr WITH(NOLOCK) WHERE attr_desc = 'CaseQty' AND attr_grp = 3)  WHERE s.spare2 = 'RELEASED'       AND shift.shift_desc = 'c'   AND DAY(ss.production_date) = DAY('2010-08-09 00:00:00.000')    AND MONTH(ss.production_date) = MONTH('2010-08-09 00:00:00.000')    AND YEAR(ss.production_date) = YEAR('2010-08-09 00:00:00.000') GROUP BY s.row_id  Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the nvarchar value 'N' to data type int. The column  type of attr_value of lot_attr table is a USER D
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