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 |
|
helpme
Posting Yak Master
141 Posts |
Posted - 2005-12-22 : 14:03:49
|
| I have the following statement:select count(*) % 2 from table1if table1 has an odd number of records, the result is '1'if table1 has an even number of records, the result is '0'Can someone explain the '%' and the '2' parameters in this statement to me? |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-12-22 : 14:11:47
|
| from BOL:>>% (Modulo) Provides the remainder of one number divided by another.so the remainder of even numbers devided by 2 will always be 0 and the remainder of odd numbers devided by 2 will always be 1Be One with the OptimizerTG |
 |
|
|
helpme
Posting Yak Master
141 Posts |
Posted - 2005-12-22 : 14:20:33
|
| Thanks for the quick reply! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-23 : 00:54:35
|
In Books On Line, SQL Server help file, goto index and type % and select content and read it. You need to make use of BOL which has lot of explanations with syntaxes MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|