SQL 2000. I have a .Net system running where I store records for two companies using the software in the same database and server. All billing and administrative work is performed by the main company. Almost all of the records are only accessible by the company that enters them. The Admin users can see all of the records. But there a few records that are shared between them and only the originating company can edit them. I use a SharedFlag Bit column for this. Right now my stored proc looks something like this
There are no plans for more than two companies now, but you never know. Wondering what the best method is to handle this situation to eliminate the OR condition. Thought maybe another "Record Shared" table with the primary key of the master table and the company number and populate this table with both companies if the record is shared, or only one company if not shared. Then I could do an inner join to get all of the records each company is allowed to view. Any better methods or should I live with the OR?
Auguy
Sylvania/Toledo Ohio
Code:
Select Column1,Column2, ... Where (Company = @Company Or SharedFlag) ...
Auguy
Sylvania/Toledo Ohio