Trigger for my query

  • Dear All,

    I am new for this , I need a trigger (INSERT and Update) for My Query.

    I have Three Tables .

    1) Employee Master.

    2) Contribution Master

    3) Emp With Contribution Master

    1) I am getting Emp Code from Emp Master.

    2) I am getting Contribution Code ,Name and Contribution Type from Contribution Master.

    Query:

    Suppose, Insert and Update in Contribution Master, automatically,"Emp With Contribution Master" with

    Code,name,empCode,contrType

    We map all Contribution Type with Emp Code in Emp With Contribution Master.So Please kindly help me.

    Example:

    In Emp Master Table Name: tbl_Emp

    EmpCode,EmpName.

    It Contains Nth of Employee Details.

    In Contribution Table Name: tbl_ConMaster

    Code,Name

    It contains Contribution Types .

    In Emp With Con Table Name: Tbl_ConEmp

    Code,empCode,conType.

    User insert or Update or Delete in the Contribution Master ,data will affect in tbl_ConEmp.

    data:

    In emp Master:

    emp Code :1

    emp Name:Narayanan.

    emp Code :2

    emp Name:Laskhmi

    emp Code :3

    emp Name:SQL

    In Contribution Master:

    Code: 01

    Name: Con1

    Code:02

    Name:Con2

    in Emp with Con

    Code : 1-Con1

    empCode:1

    ConType:Con1

    Code : 2-Con1

    empCode:2

    ConType:Con1

    Code : 1-Con2

    empCode:1

    ConType:Con2

    Code : 2-Con2

    empCode:2

    ConType:Con2

    I hope better you understand....

    Note: Emp With Contribution Master should like empCode "-" contrType .

  • Oops. Editing this because it was the answer to a different question.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • naraayanan1983 (8/11/2015)


    Dear All,

    I am new for this , I need a trigger (INSERT and Update) for My Query.

    I have Three Tables .

    1) Employee Master.

    2) Contribution Master

    3) Emp With Contribution Master

    1) I am getting Emp Code from Emp Master.

    2) I am getting Contribution Code ,Name and Contribution Type from Contribution Master.

    Query:

    Suppose, Insert and Update in Contribution Master, automatically,"Emp With Contribution Master" with

    Code,name,empCode,contrType

    We map all Contribution Type with Emp Code in Emp With Contribution Master.So Please kindly help me.

    Note: Emp With Contribution Master should like empCode "-" contrType .

    Hi and welcome to the forums. I am sure that in your mind what you want is perfectly clear. However in your post it is not clear at all. Please take a look at this article for an idea of the type of information you should post. http://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/%5B/url%5D

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply