regarding database and

Posted by Mohit02 under ASP.NET on 3/19/2012 | Points: 10 | Views : 622 | Status : [Member] | Replies : 1

I need to create database which has few tables, suppose,one table name is "master_tables" which has table_id and table_name(columns)(table_name column is which all the tables names which is in db).
suppose there is table name employee which has emp_id, name ,address + two more columns names loghistory_id and tablerow_id..(tablerowid value come from master_tables table_id).. and another table is log_history_table..(which has loghistoryid,tablerowid,rowid,operation(insert,delete,update etc),user_name(application user name),comments) if i insert record through application,after inserting successfully, the record should be inserted in both the tables means (in inserted table + log historytable) log history table i want..tablerowid of table in which record inserted,rowid,which rowid is inserted ,and which user inserted or deleted... the record and in inseted table historyrowid and table row_id columns should also be update after inserting....i searched alot but i dint get any good result..will you plzzz tell me the proper solve this task...i used 1 logic,in dal layer after inserting recordd in table i am excuteitng 1 more insert statement for insert records in log table,but i think its not correct logic..plzz suggest me with proper logic.....plzz help me for this....its very important for me....


Posted by: Rajni.Shekhar on: 3/20/2012 [Member] Bronze | Points: 25

Insert into master_tables(table_name) --table_id can be identity field
FROM sys.Tables

You can use triggers on the inserted table.

Rajni Shekhar

Mohit02, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response