sql delete - who did

I need to know how to find find any one deleted records in the sql server, any sys table there to find.
I don't want to find all records at least some one deleted records from this table...etc.

I wrote a Trigger to find out, but i like to know any system file help me to find that.any example appriciate.
Thanks
LVL 10
ukerandiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vitor MontalvãoMSSQL Senior EngineerCommented:
Only a Delete Trigger as you have or activate SQL Server auditing to track data changes. Otherwise you can't get the information you want.
ste5anSenior DeveloperCommented:
And you can examine the transaction log:

 
SELECT  T1.[Transaction ID] ,
        T1.Operation ,
        T1.Context ,
        T1.AllocUnitName ,
        T2.Operation ,
        T2.[Transaction ID] ,
        T2.[Begin Time] ,
        T2.[Transaction Name] ,
        T2.[Transaction SID] ,
        SUSER_SNAME(T2.[Transaction SID])
FROM    fn_dblog(NULL, NULL) T1
        INNER JOIN fn_dblog(NULL, NULL) T2 ON T1.[Transaction ID] = T2.[Transaction ID]
WHERE   T1.Operation = 'LOP_DELETE_ROWS'
        AND T2.Operation = 'LOP_BEGIN_XACT';

Open in new window

Vitor MontalvãoMSSQL Senior EngineerCommented:
Yes, he can check in the transaction log but only if no backup was performed since the deletes.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

HuaMin ChenProblem resolverCommented:
Sql server does not store such information and you can create log table for storing such kind of records.
ZberteocCommented:
There are few methods to accomplish this goal which can be explored here:

1. SQL Server Audit (Database Engine)
2. Change Data Capture
3. Auditing Data Changes in SQL Server using Service Broker’s External Activator

I think the 3rd link would be the best solution. Using the broker service has the advantage that works asynchronous so it won't affect performance in any way by firing triggers that will have to finish before the control is given back to the regular process.
EugeneZ ZhitomirskySQL SERVER EXPERTCommented:
what is your sql server version\edition\Service pack?
one of the 3rd party tools:

Idera's sql compliance manager
https://www.idera.com/productssolutions/sqlserver/sqlcompliancemanager
---

also you can try

to use system function  fn_dblog

SELECT
   * FROM
    fn_dblog(NULL, NULL)
WHERE
    Operation = 'LOP_DELETE_ROWS'
--

more:

"Using fn_dblog, fn_dump_dblog, and restoring with STOPBEFOREMARK to an LSN" By: Paul Randal
http://www.sqlskills.com/blogs/paul/using-fn_dblog-fn_dump_dblog-and-restoring-with-stopbeforemark-to-an-lsn/


and
"How to find user who ran DROP or DELETE statements on your SQL Server Objects'
By: Manvendra Singh  
https://www.mssqltips.com/sqlservertip/3090/how-to-find-user-who-ran-drop-or-delete-statements-on-your-sql-server-objects/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ukerandiAuthor Commented:
thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.