I have a SQL 2000 database that is shared by two offices. In one of the tables I have a column called company that normally has a One or a Two in it to indicate the different offices. For almost all of the records each office cannot see the other office's records. For the records that are "Shared", I change the company code to a negative number. This lets me write a select statement something like
I'm thinking of moving the Shared indicator (Negative Company Value) to a bit column. This will help simplify some of the other coding, but I would still need something like
I would like to eliminate the OR condition, but not sure how to go about it. At this time I'm not seeing a performance problem. The table only has about 200K records and grows by about 50K a year. I would like to accomplish this using the "Best" method in case I encounter millions records down the road. Any suggestions would be welcome.
Auguy
Sylvania/Toledo Ohio
Code:
Select Col1, Col2, ... From Table1 Where (Abs(Company) = @UserCompany Or Company < 0) And ...
Code:
Select Col1, Col2, ... From Table1 Where (Company = @UserCompany Or Shared = 1) And ...
Auguy
Sylvania/Toledo Ohio