Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
-- Create the Employee table CREATE TABLE Employee ( EmployeeID INT PRIMARY KEY, EmployeeName NVARCHAR(50), LastModified DATETIME ); insert into employee values(1, 'a',Null); -- Create the trigger CREATE TRIGGER tgn ON Employee AFTER INSERT AS BEGIN -- Update the LastModified column with the current date and time for the newly inserted rows UPDATE e SET LastModified = GETDATE() FROM Employee e --INNER JOIN INSERTED i ON e.EmployeeID = i.EmployeeID; END; select * from employee; insert into employee values(2, 'b',Null) select * from employee;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear