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)
 Querying a Datatable for Odd/Even

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-10-18 : 08:07:55
vujjeni writes "Hi, I have a datatable field called Bin which is a char(3)- eg: '001, 005' etc. I am trying to filter this datatable based on whether the Bin is Odd or Even. My filter condition would look like - 'Bin % 2 = 0'. I get an error saying -- Cannot perform 'Mod' operation on System.String and System.Int32.

Is there a way to do find the odd/even Bins?

Thanks,
Vujjeni"

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-10-18 : 08:12:06
convert to int and then apply the moduleus to it.

Chirag

http://chirikworld.blogspot.com/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-18 : 09:18:38
Why did you store numbers in char datatype?
Use proper datatype

Madhivanan

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

- Advertisement -