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.
Author |
Topic |
s.mirzaei1990
Starting Member
12 Posts |
Posted - 2014-08-07 : 03:16:52
|
I have 4 tables (people,manager,student and clerk) (manager,student and clerk) these tables inherite from people table and nationalcode is foreign key and primary key for all tables,but I want a function when I register a person in the manager table ,this function doesn’t allow to register this person in the student table & clerk table.how can write this function? |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-08-07 : 07:53:06
|
Not sure what you mean by "inherit" in a SQL server context. SQL Server is not and Object Oriented database, so has no concept of inheritance.Please post:1. CREATE TABLE statements to create the four tables 2. INSERT INTO statements to populate the four tables with test data3. The queries you use to populate those tables4. Assuming you had a function 'f', new queries using that function to accomplish your goal. |
|
|
s.mirzaei1990
Starting Member
12 Posts |
Posted - 2014-08-07 : 09:07:04
|
i know that the sql server isn't Object Oriented database,but this way makes that your tables don't have any duplicate columns and your duplicate columns save in new tables such as people.and these tables can connect by foreign key to people.now i want a function that doesn't allow to register same data in manager and student or manager and clerk. |
|
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-08-07 : 11:04:14
|
Please post the items I mentioned before:1. CREATE TABLE statements to create the four tables 2. INSERT INTO statements to populate the four tables with test data3. The queries you use to populate those tables4. Assuming you had a function 'f', new queries using that function to accomplish your goal. |
|
|
|
|
|