Search code examples
sql-serverdatabasedatabase-normalization

How to auto insert values in dependency table?


I have created three tables. One is named as User and second is Folder and third one is User Folder Rights Table . I have inserted values in table by using Query

Insert into Users values ('admin','123');

Insert into Folders values ('folderA');

enter image description here

Third table is Normalized Table and dependent on both these tables. As i executed these above defined queries, Nothing stores in third table User Folder Rights Table shown in this above image.

What is the reason of this behavior and secondly how to automatically generate values in this Third Table when these two above explained queries will execute?

If my question is not clear to you please ask me.


Solution

  • Use Triggers to achieve this goal. Please follow this Article . It has detailed description.

    Thank's Tameen.