[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

SQL Update sys_logins table

Posted on 2013-11-21
1
Medium Priority
?
912 Views
Last Modified: 2013-11-26
Is there a way for me to update the sys.sql_logins table?  I would like to turn on password policy and expiration.  However, I do not want to do it one by one.  I would like to be able to do a mass update with user that does not have this on.  Any ideas?

Update sys.sql_logins
set is_policy_checked = 1,
      is_expiration_checked = 1
where is_policy_Checked = 1 or is_expiration_checked = 1

Getting the following error.

Ad hoc updates to system catalogs are not allowed.
0
Comment
Question by:holemania
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
Steve Wales earned 2000 total points
ID: 39667167
You aren't allowed to directly update the system tables.

Run this script, sending output to text, instead of grid:

select 'ALTER LOGIN ['+name+'] WITH CHECK_EXPIRATION=ON, CHECK_POLICY=ON'
from sys.sql_logins
where is_policy_Checked = 1 or is_expiration_checked = 1

Open in new window


Check your output, remove or modify any you don't need, copy that into a query window and run it.

Will do exactly the thing you want done without the direct update of the system catalog tables.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question