Hello I feel really stuck because i don't code in SQL that often,
I have two tables one is Subproject and SubprojectVisibilitySettings
Example columns in tables
Table Subproject - SubprojectId | SubprojectName | SubprojectType
Table SubprojectVisibilitySettings - UserName | SubprojectId_vis | SubprojectName_Vis | SubprojectType_Vis
I need to make a trigger that checks if new column was added to Subproject table if yes then also add the column with the same name + suffix "_Vis" to table SubprojectVisibilitySettings table.
Expected result
Table Subproject - SubprojectId | SubprojectName | SubprojectType | SubprojectDate
Table SubprojectVisibilitySettings - UserName | SubprojectId_vis | SubprojectName_Vis | SubprojectType_Vis | SuprojectDate_Vis
If someone would help me to solve this I would be really thankful.
1条答案
按热度按时间ru9i0ody1#
I found one way to create trigger for my needs I don't know if its good solution but works for me. So if someone struggles like me just try this.
Creating the trigger
Alter table Subproject adding new column
The result