Solved

SQL Update sys_logins table

Posted on 2013-11-21
1
768 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
1 Comment
 
LVL 22

Accepted Solution

by:
Steve Wales earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
return result by latest date - oracle query 21 70
MySQL left join performance 4 30
subtract 1 in Access 2003 query 7 39
Access 2010 Query Syntax 5 23
As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now