August 17, 2004 at 5:59 am
I have a small table ( 316 rows ), and need to create a view from that table. I need to divide one field by another. The divisor will never be zero, but when I run the query, I get a "divide by zero" error on row 17. I then delete much of the data, to only give me 20 rows, and I get a result on all 20 rows, row 17 is OK.
Has anyone seen such behavious previously ?
August 17, 2004 at 4:28 pm
Row 17 from your view definition most likely wasn't row 17 from your query. SQL doesn't guarantee the order that your data is presented in unless you use an "order by" clause. In other words, to SQL, there really is no such thing as record #17.
Try reloading all 316 rows, then execute a query with "order by" on the table to locate the bad record.
Steve
August 18, 2004 at 1:24 am
Steve,
That's exactly what was happening. There is an occasional zero in the data ( at row 36, in this case ) but SQL server kept on showing the error at row 17. I've added a test for zeros in this column, and it's now working perfectly.
many thanks,
Dave
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply