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. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


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.