Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Sql Server Programming

How to represent the RESOURCES?

I need a way to represent the RESOURCES.
For example, employee and machines are resources.  I create two tables named
employee (EID as PK) and machine(MID as PK). and create a view named
Resource (RID as key) as followed,

create view Resource as
select EID RID, name
from Employee
union all
select MID, name
from machine

It's great for me since now.

However, if another table refer to RID, I cannot create a FK reference for
it because Resource is a view but not a table.

What I mean is,

+------------+                        +------------+
| Resource |--------------------|  TABLE   |
+------------+             +RID  +-------------+

So, how to represent the RESOURCES?


---Frank Lee

On Feb 1, 3:45 am, "Frank" <D@reply.to.me> wrote:

Try reorganizing your table like this

01  empl1     EMP
02  empl2     EMP
03  mach1     PC
04  mach2     PC

If Re-organazing is not feasable
create a third table

01  empl1
02  empl2

01  mach1
02  mach2

RID Machid-Empid   RType
01    01                  EMP
02    02                  EMP
03    01                  PC
04    02                  PC


The latter seems to be good.

"schal" <shivaramcha@gmail.com>

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc