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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 A domain error occurred

Author  Topic 

tikus
Starting Member

31 Posts

Posted - 2004-12-16 : 21:26:41
Has anyone ever encounter this "A domain error occurred." error when running script in SQL Analyzer? I just couldn't figure out what happened. In my query, I use a UDF to calculate the distance between two zipcodes. If I use dynamic Zipcodes, for example,

select Distance(x.ZipCode1, y.ZipCode)
from x inner join y on 1 = 1

I got this error. If I fixed one of the ZipCode

select Distance(x.ZipCode1, '12243')
from x inner join y on 1 = 1

It ran okay .

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-16 : 21:48:14
Not the problem but it should be

select Distance(x.ZipCode1, y.ZipCode)
from x cross join y

What happens if you include only one row?
i.e. is it a particular pair that causes the problem?

That error usually turns up with math functions that take a value outside the valid range
e.g. acos(2)



==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

tikus
Starting Member

31 Posts

Posted - 2004-12-20 : 20:06:28
Hello, I haven't had time to work on this issue cause I was too busy working on other things.

Yes, you made a very good point here. The UDF uses SIN, COS to calculate the distance. I think this could be the problem. At least I know where to look for the problem now. Thanks a lot!!!
Go to Top of Page
   

- Advertisement -