Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a SQL Authentication User: JOHNDOE

I would like this account to auto-expire or auto-disable after X days or at a certain date/time. Any suggestions or best practices to do this?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You could setup a job that reads from a table containing a list of logins and their expiration dates. For every login that is expired in this table it could just drop it. There you could also automatically deal with users associated with and databases own by this login.

share|improve this answer

There's no native way to do this. You'll have to create a SQL Agent job which disabled the login and the specific time.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.