Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
MyronCope
Starting Member
46 Posts |
Posted - 2011-02-03 : 10:21:37
|
using sql server 2005.I am creating a query to get the last order for each customer and this is why I"m using the rownum field below (a customer can have many orders in the ORDERS table). however when I use the syntax below I am getting the following error:<ERROR>Arithmetic overflow error converting expression to data type int.Warning: Null value is eliminated by an aggregate or other SET operation.</ERROR>Have any of you seen this or know how to fix it? I am thinking that I need to check rownum for null but when I tried that it was not possible because rownum is not a column, please help if possible. The query that I'm using is below: [list] [*] SELECT CUSTOMER.custID FROM (select row_number() over (partition by custID order by ordDate DESC) rownum,* from ORDERS)As ORDS, dbo.epicorimport_customer --some joins here where rownum=1 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-02-03 : 10:55:40
|
| The problem is probably in one of your joins. One column is a string and the other one it's joining to is an int.JimEveryday I learn something that somebody else already knew |
 |
|
|
MyronCope
Starting Member
46 Posts |
Posted - 2011-02-03 : 11:51:26
|
quote: Originally posted by jimf The problem is probably in one of your joins. One column is a string and the other one it's joining to is an int.JimEveryday I learn something that somebody else already knew
thanks, that was it. |
 |
|
|
|
|
|