March 10, 2015 at 1:38 pm
Ed Wagner (3/10/2015)
Sean Lange (3/10/2015)
raulggonzalez (3/10/2015)
Sean Lange (3/10/2015)
I knew of the function to return the login for the current connection, but I thought it was like GETDATE() where you just provide the parentheses because they're required. I guess I should take a closer look at some of those functions once in a while.
Glad it helped but give the credit to Randal's post, it's all there... :w00t:
March 11, 2015 at 12:24 am
raulggonzalez (3/10/2015)
Sean Lange (3/10/2015)
I knew about fn_dblog but answered that you can't do it without third party because the question was asking for "whodunnit" which to the best of my knowledge you can't determine from that. Is the something in there that can be used to tie that back to a user?Please check this out
select SUSER_SNAME([Transaction SID]), *
from fn_dblog(null,null)
Thanx 4 sharing the script, but if u have a common SQL login that is being used by an application accessed by many users, then it`s kind of useless unless u have other information like host name or IP address.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
March 11, 2015 at 3:13 am
Hany Helmy (3/11/2015)
raulggonzalez (3/10/2015)
Sean Lange (3/10/2015)
Thanx 4 sharing the script, but if u have a common SQL login that is being used by an application accessed by many users, then it`s kind of useless unless u have other information like host name or IP address.
Well, that's a completely different story, I guess the log writes enough to redo a transaction when restored, so if it doesn't write that info (or maybe the function does not retrieve it), most probably is not required for the purpose.
You can check the available columns using this
SELECT TOP 1 *
INTO #fn_dblog
FROM fn_dblog(null,null)
EXECUTE tempdb..sp_help '#fn_dblog'
March 11, 2015 at 6:57 am
Hany Helmy (3/11/2015)
raulggonzalez (3/10/2015)
Sean Lange (3/10/2015)
I knew about fn_dblog but answered that you can't do it without third party because the question was asking for "whodunnit" which to the best of my knowledge you can't determine from that. Is the something in there that can be used to tie that back to a user?Please check this out
select SUSER_SNAME([Transaction SID]), *
from fn_dblog(null,null)
Thanx 4 sharing the script, but if u have a common SQL login that is being used by an application accessed by many users, then it`s kind of useless unless u have other information like host name or IP address.
That is true. However keep in mind the original question is about dropping a table. I would hope your application doesn't make a habit of dropping tables. 😉
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
March 11, 2015 at 8:31 am
Sean Lange (3/11/2015)
Hany Helmy (3/11/2015)
raulggonzalez (3/10/2015)
Sean Lange (3/10/2015)
I knew about fn_dblog but answered that you can't do it without third party because the question was asking for "whodunnit" which to the best of my knowledge you can't determine from that. Is the something in there that can be used to tie that back to a user?Please check this out
select SUSER_SNAME([Transaction SID]), *
from fn_dblog(null,null)
Thanx 4 sharing the script, but if u have a common SQL login that is being used by an application accessed by many users, then it`s kind of useless unless u have other information like host name or IP address.
That is true. However keep in mind the original question is about dropping a table. I would hope your application doesn't make a habit of dropping tables. 😉
I certainly hope not. If so, be sure to find a deep hole for the developer. 😛
March 11, 2015 at 12:55 pm
Thanks for the question.
March 25, 2015 at 1:12 am
Excellent question / information. Really glad to know this
Thank you all for the nice explanations
Viewing 7 posts - 16 through 21 (of 21 total)
You must be logged in to reply to this topic. Login to reply