Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Log information in to a Table!


Log information in to a Table!

Author
Message
$ammy
$ammy
SSC Rookie
SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)

Group: General Forum Members
Points: 26 Visits: 200
Hi,

I have created a SP which is used for Backup/Restore. Now the problem is I need to create a table which is used for collecting the log information,

I.E When Procedure is executed, the execution of Procedure should be in the table which should contain following fields

Who(Which user used the Procedure), What they executed(backup/Restore) & Path (Where backup is taken or Restored etc).


Any thoughts on this ???
robert.gerald.taylor
robert.gerald.taylor
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1326 Visits: 1399
$ammy (9/16/2012)
Hi,

I have created a SP which is used for Backup/Restore. Now the problem is I need to create a table which is used for collecting the log information,

I.E When Procedure is executed, the execution of Procedure should be in the table which should contain following fields

Who(Which user used the Procedure), What they executed(backup/Restore) & Path (Where backup is taken or Restored etc).

Any thoughts on this ???


I'm probably not fully understanding what you're asking, but it sounds like you just want an insert into your logging table (create a table for this log info if you don't have it already). You probably already have a parameter on your proc whether it's for Backup or Restore. Is the path a parameter of the procedure as well? (probably). You can get the user from suser_sname().


INSERT dbo.YourLoggingTable (UserId, ExecutionType, Filename, ExecutionStart) VALUES (suser_sname(), @ExecType, @Filename, GETDATE());


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search