Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server 2005 Security
»
Auditing Logins in Sql Server 2005
Auditing Logins in Sql Server 2005
Rate Topic
Display Mode
Topic Options
Author
Message
chinn
chinn
Posted Monday, August 17, 2009 8:29 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: 2 days ago @ 9:32 AM
Points: 127,
Visits: 490
Hello All,
I am using the below code to caputre logins it works great.
http://www.sqlservercentral.com/articles/SQLServerCentral/sqlserver2005logontriggers/2366/
I wanted a piece of code in the stored proc to acheive the below...
If a particuare username already exists in the "Logging" table in a day.
I dont want to capture/insert it again.
This way i am trying to eliminate duplicate captures and maintain the size of the table or if there is a better way to do this.Please let me know.
Any suggestions would be greatly appreciated.
Thanks in Advance!
Post #771948
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Monday, August 17, 2009 9:43 AM
SSC-Dedicated
Group: Administrators
Last Login: Yesterday @ 1:47 PM
Points: 31,406,
Visits: 13,722
you could easily check to see if the person had already logged in on that day by checking user name, day, month, year before inserting.
However, are you trying to just see who logged in during a particular day? If so, how does that help you with auditing?
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #772022
chinn
chinn
Posted Monday, August 17, 2009 9:50 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: 2 days ago @ 9:32 AM
Points: 127,
Visits: 490
Steve,
Thanks For Your Reply!
We are primarily using this to remove unused id's on a Server .If a login has not been used for 90 days we want to look at it and talk to application team and remove if not necessary any more.
I wanted to check before inserting...but i couldnt figure it out....
Thanks Again...
Post #772031
Clive Strong
Clive Strong
Posted Monday, August 17, 2009 10:20 AM
SSC Eights!
Group: General Forum Members
Last Login: Monday, May 13, 2013 10:12 AM
Points: 959,
Visits: 6,341
Steve nailed it.
However, I'm not sure if this would be applicable in your environment, but we had one user who used their login credentials in an excel spreadsheet and this was still active after he left.
We're only a small company, so I know who is here and who has since left...For a company with hundreds or thousands of users, you might well cross reference your login list against an HR employee list to see if you have any applications using logins which need removing.
Post #772075
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Monday, August 17, 2009 10:28 AM
SSC-Dedicated
Group: Administrators
Last Login: Yesterday @ 1:47 PM
Points: 31,406,
Visits: 13,722
The check should work
if exists (select from ... day = day, month = month, etc.)
Then I'd disable those not used for 90 days, but I wouldn't remove something until 365 days had passed. I've been burned by those once a year processes before.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #772086
chinn
chinn
Posted Monday, August 17, 2009 10:32 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: 2 days ago @ 9:32 AM
Points: 127,
Visits: 490
Thanks Steve!
Thanks For The Tip...
Post #772089
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.