Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi,I got an database design in SQL Server 2008.I design a simple login database with 4 table:RolesUsersEmployeesClientsUsers include Client and Employee. It means both Client and Employee can login into system. I mean UserId can be EmployeeId or ClientId. But how to make relation between Users table and Employees and Clients.Case 1:I just implemented this and when I insert row to Users table, SQL Server appears an error message like thisIf UserId is a foreign key references to EmployeeId and ClientId, EmployeeId and ClientId must be the same. It's illogical.Case 2:Employees and Clients are important tables. If I don't need login function, I will delete Users table. If I set relation like this, when I delete Users table, it means Clients and Employees tables will be deleted too. It's not data integrity.Please help me make relation between these tables.Thank you so much.