SQL Server - how to update particular column after updating row?
Asked By sai patil on 13-Aug-13 09:49 AM
I need to update "E_Update_No" column after updating particular row.
E_id E_Update_No E_Name E_Addr E_Status
1 Sai Delhi
2 Ram Delhi
3 Sham Patna
Suppose i have updated Record 2 ,then i need to updated "E_Update_No" column automatically like:
E_id E_Update_No E_Name E_Addr E_Status
1 Sai Delhi
2 Ram Delhi
2 1 Ram Patna Update
2 2 Ram Chennai Update
3 Sham Patna
i have updated record 2 with column "E_Addr" and "E_Status" 2 times.
Robbe Morris replied to sai patil on 13-Aug-13 09:49 AM
update
set E_Update_No = E_Update_No + 1,
e_Name = 'Ram'
where something blah blah blah
Every time you perform the update, the e_Update_No column will be incremented