make sure you test in non production environments
USE master;
GO
CREATE DATABASE Test;
GO
USE Test;
GO
CREATE TABLE TestTable (
c1 INT IDENTITY,
c2 CHAR (100) DEFAULT 'a');
GO
CREATE CLUSTERED INDEX TT_CL ON TestTable (c1);
GO
INSERT INTO TestTable DEFAULT VALUES;
GO
SELECT OBJECT_ID ('TestTable');---2105058535
GO
DROP TABLE TestTable;
GO
--DROP DATABASE Test
First we need to find the transactions that drop tables in the log. The following code works for 2000, 2005, and 2008:
SELECT [Transaction Id], [Begin Time], [SPID]
FROM ::fn_dblog (NULL, NULL)
WHERE [Transaction Name] = 'DROPOBJ'
SP_who2---find spid
you will know who dropped the table ..
Thanks
No comments:
Post a Comment