views:

36

answers:

4

When I run my .net app connected to SQL Server 2000, I get the error "invalid Floating Point Operation". I did search for the error cause http://fugato.net/2005/02/08/sql-server-nastiness found this link which says there may be Bogus Data in one of the columns.

I have a backup from a month old data, when I connect to the old database it works fine.

How do I filter out the bogus data in the table?

+3  A: 

One method might be to use a cursor to perform the problematic operation row by row printing id's as you go along, when the error occurs you can refer to the printed id's to see which row contains the erroneous data.

There is probably a better way however, this is just what came to mind!

Paul Creasey
There may be a "better" way, but this is simple and easy to implement, which is a big plus in my book.
Barry
Just remember to remove that cursor again before you go into production....
marc_s
So I found the problem ,I have a Float value "1E+21" which was causing the problem I dont know why SQL Accepts the E Format,i updated that to zero now everything is fine thanks
ThinkingCap
A: 

Do you know which table(s) are causing the problem? Can you run a SELECT * FROM... against these tables + get results? If so, select from the tables and order by each of the FLOAT / REAL / NUMERIC / DECIMAL columns and look at the ends to see if there are any 'oddities'.

Will A
+1  A: 

You need to narrow down your problem:

  • When exactly does this happen? What SQL query is being executed that causes the problem??

  • Once you have the query - look at what the query does; check those tables - are you possibly converting a VARCHAR field into a numeric value, and some values aren't all numeric?

  • Or are you reading data using a SqlDataReader and you're not paying attention to the fact the data contained in SQL Server might not be what you expect??

marc_s
+1  A: 
select col
from tbl 
group by col 
having count(col) = 1

there's probably only one instance of the bad value

Beth