Hi All,
I am trying to INSERT INTO base table so that my trigger returns the expected output. But when I do that I get error-
Msg 8152, Level 16, State 13, Procedure tr_tblemployee_ForInsert, Line 10
String or binary data would be truncated.
The statement has been terminated.
I am using:
CREATE TRIGGER tr_tblemployee_ForInsert
on tblemployee
FOR INSERT
AS
BEGIN
DECLARE @EmployeeID Int
SELECT @EmployeeID = EmployeeID FROM INSERTED
INSERT INTO tblEmployAudit VALUES (
'New Employee with ID =' +
CAST(@EMPLOYEEID as NVARCHAR(20)) +
'added at' +
CAST(GETDATE() as NVARCHAR(20))
)
END
The tblemployee table has EmployeeID as INT type and the tblEmployAudit table has EmployeeID as Primary key INT type.
Please advise.
Best R.
Sk