Tuesday, February 14, 2012

Deny login for SQL Server Authenticated accounts

Hi,
I want to prevent users from logging into a database (which will occur once
a week for several hours), and once I've done the table changes, allow them
to access the db again.
How can I do this?
I've looked at sp_denylogin but appear to only work for NT Authenticated
accounts. Is there an equivalent system stored procedure for denying SQL
Server Authenticated users from logging into a db?
Thanks.
EricHi,
I recommend you to start the database in SINGLE USER mode or set the
database to RESTRICTED mode before changing rhe schema.
ALTER DATABASE <DBNAME> set SINGLE_USER
or
ALTER DATABASE <DBNAME> set RESTRICTED_USER
Once the schema change is over you set back to multi user mode.
ALTER DATABASE <DBNAME> set MULTI_USER
Thanks
Hari
SQL Server MVP
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:B43425AD-2FC0-40CB-AD96-0F160E45D1B5@.microsoft.com...
> Hi,
> I want to prevent users from logging into a database (which will occur
> once
> a week for several hours), and once I've done the table changes, allow
> them
> to access the db again.
> How can I do this?
> I've looked at sp_denylogin but appear to only work for NT Authenticated
> accounts. Is there an equivalent system stored procedure for denying SQL
> Server Authenticated users from logging into a db?
> Thanks.
> Eric

No comments:

Post a Comment