sacacompany
Member
- Local time
- Tomorrow, 00:00
- Joined
- Dec 28, 2022
- Messages
- 31
hi i m just wondering if i can put all deleted records from table in a on table that has a column and insert deleted row into it by concatenating..i created a trigger but its giving error on column name!!!...below is the trigger.....
USE database;
GO
CREATE TRIGGER TenantDeleted ON RT_Tenant
AFTER DELETE
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO DeletedRecord (ID, Record, delDate, UserID)
SELECT [ID],
CONVERT(VARCHAR(MAX),
ISNULL([TenantID], '') + ', ' +
ISNULL([Name], '') + ', ' +
ISNULL([Address], '') + ', ' +
ISNULL([City], '') + ', ' +
ISNULL([ContactPerson], '') + ', ' +
ISNULL(, '') + ', ' +
ISNULL([Mobile], '') + ', ' +
ISNULL([Phone], '') + ', ' +
ISNULL([METERNO], '')
) AS RECORD,
GETDATE(),
SYSTEM_USER
FROM deleted;
END;
USE database;
GO
CREATE TRIGGER TenantDeleted ON RT_Tenant
AFTER DELETE
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO DeletedRecord (ID, Record, delDate, UserID)
SELECT [ID],
CONVERT(VARCHAR(MAX),
ISNULL([TenantID], '') + ', ' +
ISNULL([Name], '') + ', ' +
ISNULL([Address], '') + ', ' +
ISNULL([City], '') + ', ' +
ISNULL([ContactPerson], '') + ', ' +
ISNULL(, '') + ', ' +
ISNULL([Mobile], '') + ', ' +
ISNULL([Phone], '') + ', ' +
ISNULL([METERNO], '')
) AS RECORD,
GETDATE(),
SYSTEM_USER
FROM deleted;
END;