help writing stored procs

  • Hi,

    I need to create three stored procs (sp_save1, sp_save2, sp_save3) with the below given criteria

    the save procedures above will take each column in its related table as aparameter. The procedures should have an IF statement. If the ID being sent is less than 0, the parameters should be inserted into the table. If the ID being sent is greater than 0, the  parameters should update the row with the given ID

    The save procedures should also return the ID, If a new row is inserted return the @@IDENTITY of the new row. If a row is updated, just rerturn the ID that was passed into the procedure.

    Finally when updating a row, a row needs to be inserted into the audit_trail table for each column that changed.

     

    Another set of three stored procs (sp_delete1, sp_delete2, sp_delete3) with below given criteria

    The delete procedures will take an ID and MODIFY_ID as parameters. The procedures should update a column to ACTIVE_IND and the MODIFY_ID to the MODIFY_ID that has been passed into the procedure. In addition, the MODIFY_DATE should be updated to the system date.

    The delete procedure will also have to make an entry into the AUDIT_TRAIL table for ACTIVE_IND change.

    Final stored proc (sp_get1)

    This procedure will return all columns from three tables. It will only take a column as a parameter and will return the appropriate task detail and its related notes and resources in three seperate select statements.

    Any help in writing the above stored procedures is greatly appreciated -

    Regards

  • hi shweta.

    can u give me the details structure of your tables

    i will try to create sp for your problem

  • Hi Shahi kant,

    thank you for your quick response, since the structure of the tables is big I sent it thru private message. Please let me know if you didn't receive it

    Appreciate your help - thanks again!!!

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

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