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
 SQL Server Development (2000)
 Geting multiples of number

Author  Topic 

jpfo
Starting Member

7 Posts

Posted - 2005-10-13 : 09:42:22
Hi all,

I want to make a query condition to get all values in a numeric type field that are multiples of 5.
I've no ideia how can i put this in work... help needed with the condition, pls.

Best regards to u all m8.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-13 : 09:45:04
Select yourColumn from yourTable where yourColumn % 5 = 0

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jpfo
Starting Member

7 Posts

Posted - 2005-10-13 : 09:56:40
i remember u the field is numeric.

Trying:
SELECT * from MyTable
Where MyField % 5 = 0

The result is:
Operand type clash: int is incompatible with void type
Operand data type numeric is invalid for modulo operator.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-13 : 10:15:13
Try this

Select yourColumn from yourTable where cast(yourColumn as int) % 5 = 0


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jpfo
Starting Member

7 Posts

Posted - 2005-10-13 : 10:25:36
tks, work fine
Go to Top of Page
   

- Advertisement -