Hi Ram,
CREATE TRIGGER DeleteLogRecords
ON mainlog FOR DELETE
AS
BEGIN
SET NOCOUNT ON
IF EXISTS(SELECT * FROM mainlog)
INSERT INTO users2.dbo.sparelog
SELECT * FROM deleted
ELSE
INSERT INTO users2.dbo.sparelog
SELECT * FROM deleted
END
<pre lang="sql">CREATE TRIGGER UpdateLogRecords
ON mainlog FOR UPDATE
AS
BEGIN
SET NOCOUNT ON
IF EXISTS(SELECT * FROM mainlog)
INSERT INTO users2.dbo.sparelog
SELECT * FROM Inserted
ELSE
INSERT INTO users2.dbo.sparelog
SELECT * FROM Inserted
END</pre>
Check the above query.
Hope its useful
Regards,
Babu.K