Versions des environnements
>>>>Novice question about MS SqlServer.
>>>>
>>>>I have an application which uses what I call an "overloaded" table. By that I mean that it contains columns of relational key ID's that can relate to different tables depending on another definitive field in the table. For example, x1_ID relates the record to an Invoice header if the xntype field value is "CHARGE" or "PAYMENT" but if the xntype field value is "INVRECEIVE", x1_ID relates the record to a Purchase Order Header record.
>>>>
>>>>This structure has worked well for me for several years in VFP but I have been told that it is not allowed in a SQL Server table. Have I been misinformed or have I been misusing this capability in VFP ?
>>>>
>>>>Thanks,
>>>>
>>>>Ken
>>>
>>>It's not allowed in SQL Server - you will not be able to set up pk/fk relationship correctly. I suggest to re-think this model.
>>
>>You can do it though. Not allowed is rather strong
>>
>>I agree with Dragan
>
>You can, but as I said, you will not be able to define PK/FK and this is against good practices.
you can define PK/FK.
1. define id,xntype as an unique index ( or primary key, where id field is primary too )
on child tables define xntype as a fixed compute field.
define the UK/FK relationschip.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement