deny login to SQL after working hours

  • Hi,

    how can i disable certain users to make login into the SQL SERVER after working hours?

    i know that i can create a DDL LOGON TRIGGER but what is the syntax for the deny login(i use SQL authentication)?

    THX

  • LOGON_Triggers would be one way to go and you can find a good article about how to do it here[/url].

    Another option would be creating a job which disables the login(s) after working hours and enables it again in the morning.

    The syntax is simply

    ALTER LOGIN login_name DISABLE /ENABLE

    Only thing to keep in mind is that both solutions only prevent users from making new connections. Existing connections can still be used.

    [font="Verdana"]Markus Bohse[/font]

  • OK.but how i can prevent the user from login?

    by issue a rollback or there is a deny logon syntax?

    THX

  • Disabling a Login will prevent the users to logon. Existing connections you need to Kill, just like it's done in the article about logon triggers.

    [font="Verdana"]Markus Bohse[/font]

  • Issuing a rollback on a logon_trigger prevents the connection from succeeding.


    * Noel

  • Hope you find this useful:

    http://www.sqljunkies.com/WebLog/ktegels/archive/2006/11/09/25306.aspx

    MJ

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply