Hey there so I'm trying to create a trigger in SQL Server to automatic insert getdate() and SYSTEM_USER in a column after a record has been updated instead of including in a Update Query.
DB: Company
Table: dbo.Lincensee
Column: DateModified -> I want to Insert: getdate()
Column: ModifiedBy - > I want to insert: SYSTEM_USER
After a specific Record has been updated from a Query Running in C#.
Query for example:
string strQuery = @"UPDATE dbo.Licensee SET LNAME = @LastName,
FNAME = @FirstName,
MIDNAME = @MiddleName,
FIRMNAME = @OrganizationName,
SSN = @SSN,
WHERE LICNUM = @licenseToUpdate";
SqlCommand updateCommand = new SqlCommand(strQuery, connUpdateLicense);
...
PS: I can Hard code it inside the Set query, but I rather have it in a Trigger.
Any Ideas? Thank you.