SQLServerCentral - www.sqlservercentral.com

A community of more than 1,600,000 database professionals and growing

Featured Contents

Featured Script

The Voice of the DBA

SQL Server Authenticated Users, why are we still using them?

Today we have a guest editorial as Steve is on vacation.

I will start with a short explanation for those unfamiliar with this topic. SQL Server has two avenues by which users can access the database and login. One is SQL Server Authentication where a SQL Login or user is created and a password is stored and managed by SQL Server. The other method is to use Active Directory users and groups for login and control user access.

I remember back with SQL 6.5 when SQL Authenticated Users were the only real option. Windows 95 was still the main operating system and many people were still using Novell Netware for networking. There just weren’t a lot of options back then. Next came Windows NT, and soon after Windows 2000, and Active Directory became a way of authenticating users. All of a sudden by SQL Server 2005 everyone was pushing for people to be using windows authentication and network users and groups instead of SQL users to login in to SQL Server.

So, 2005 is already 13 years ago, and I would guess a lot of us are still using and supporting SQL servers that are running in mixed mode (allowing both SQL and AD authentication). Why are we still using SQL Authenticated users?  Certainly part of it may be because they are easy to setup. I would guess most DBA’s don’t have access to manage their company’s Active Directory and cannot create new AD groups or users.  Also, I suppose there are some AD Domain Admins that just don’t want to create a new group and manage which users are in that group.

All the same, I would argue that the concerns over security should push companies to using AD authenticated users and groups for access to SQL server. We know that SQL authenticated user names and passwords are in clear text in connection strings. These connection strings are often stored in plain text config files. This is not secure and we know since these usernames and passwords are hardcoded it causes us to never, or only with great pain and hardship, change the SQL user’s password.

I would encourage all of you who are managing systems with SQL authentication users to think seriously about trying to change it. I have found very few situations where SQL users should be used. Make sure you are not causing your systems to be less secure just for convenience or because it seems like too much work to fix it.

I admit, the company I currently work for does still run their SQL Servers in mixed mode and there are still a handful of SQL users being used. Still the majority of access is AD authenticated and we are working to remove the last pockets of resistance. How about you? Does your company run their servers in mixed mode? What keeps you from removing SQL authenticated users from your systems?

Ben Kubicek from SQLServerCentral.com

Join the debate, and respond to today's editorial on the forums

ADVERTISEMENT
SQL Prompt

Become a more efficient SQL developer with SQL Prompt

Learn how to write SQL faster and more efficiently with these exclusive short videos from Data Platform MVPs and SQL Server experts. With SQL Prompt you can strip out the repetition of coding and write SQL 50% faster. Check out the tips

SQL Source Control

How to track every change to your SQL Server database

See who’s changing your database, alongside affected objects, date, time, and reason for the change with SQL Source Control. Get a full change history in your source control system. Learn more

Featured Contents

 

Exam 70-462: Using Azure for the Practice Setup

Nathan Bell from SQLServerCentral.com

A step-by-step guide to creating a practice setup for the 70-462 exam using Azure virtual machines. More »


 

Troubleshooting Parameter Sniffing Issues the Right Way: Part 1

Additional Articles from Brent Ozar Unlimited Blog

Tara Kizer explains that many of you are troubleshooting Parameter Sniffing issues the wrong way in production. In this three-part series, she will show you how to troubleshoot it the right way. More »


 

When to use the SELECT…INTO statement

SELECT…INTO is a good way of making a table-source temporarily persistent as part of a process, if you don’t care about constraints, indexes or special columns. More »


 

From the SQLServerCentral Blogs - I learned about the order of logical operations #SQLNewBlogger

Steve Jones from SQLServerCentral Blogs

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as... More »


 

From the SQLServerCentral Blogs - Parsing the PASS Blog Posts about FY 19 and SQLSaturday

Andy Warren from SQLServerCentral Blogs

In February PASS President Grant Fritchey posted PASS Priorities FY 19 followed by An Open Letter to SQLSaturday Organizers, and then held... More »

Question of the Day

Today's Question (by Steve Jones):

I realize that the guest user is enabled in the Finance database, and I want to remove this as an attack vector. How can I prevent anyone from using the guest account in the Finance database?

Think you know the answer? Click here, and find out if you are right.


We keep track of your score to give you bragging rights against your peers.
This question is worth 1 point in this category: Security.

We'd love to give you credit for your own question and answer.
To submit a QOTD, simply log in to the Contribution Center.

ADVERTISEMENT

SQL Server Query Store In Action

The Query Store changes the way you monitor performance on your databases and the way you tune the performance of those same databases. This book represents a deep dive into a large number of topics in and around the Query Store. Get your copy from Amazon today.

Yesterday's Question of the Day

Yesterday's Question (by Igor Micev):

You have two tables tbl1 and tbl2. You have to obtain all values that exist in tbl1 only and in tbl2 only.

For this example

 ;WITH tbl1 AS ( SELECT a FROM ( VALUES ('a'),('b'),('c'),('d')) AS x(a) ), tbl2 AS ( SELECT a FROM ( VALUES ('f'),('a'),('b'),('c')) AS x(a) )

Which of the following queries will produce the output?

 a ---- d f 

Answer: (select a from tbl1 except select a from tbl2) union (select a from tbl2 except select a from tbl1)

Explanation:

The correct answer is:

 (select a from tbl1 except select a from tbl2) union (select a from tbl2 except select a from tbl1)

 This QotD was inspired by the SymmetricExceptWith method of the HasSet class in C#. The same QotD solution by using C# is the following:

 char[] cArr1 = { 'a', 'b', 'c', 'd' }; char[] cArr2 = { 'f', 'a', 'b', 'c' }; var hash = new HashSet<char>(cArr1); hash.SymmetricExceptWith(cArr2); Console.WriteLine(hash.ToArray());

And of course there are other solutions by using t-sql for the same problem. Expect them in the comments ;)

References: 

click here

click here

click here


» Discuss this question and answer on the forums

Featured Script

New string functions in SQL Server 2017

Jayendra Viswanathan from SQLServerCentral.com

1.  CONCAT_WS is simple to use function in new SQL Server 2017. We shall see some short examples to understand it better. The purpose of the function is to concatanate the columns with a delimeter. Below are the sample :
Below is the output on example CONCAT_WS

2. TRANSLATE is used to translate the given characters with the new character set for a given string. Below is the output on example TRANSLATE 

3. TRIM is used remove spaces as default and/or we can remove other specified characters from start or at the end of string. Below is the output on example TRIM 


We shall remove the * which is precent at the begening of the data. Below is the output on example TRIM 


We saw three SQL Functions - CONCAT_WS , TRANSLATE and TRIM with examples.

More »

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.

SQL Server 2017 : SQL Server 2017 - Administration

minimum right to run this script - Hello everyone I will need to run this query on all my databasesDECLARE @t_spaceused TABLE ( DatabaseName SYSNAME, DatabaseNameLogic VARCHAR(255), DatabaseNamePhysical VARCHAR(255), TypeDesc...

Availibity group and windows cluster - We are planning to install a SQL server 2017 standard. But in near future we probably will create another instance...

SSDT 2017/2015 Installation failure on Windows 10 - Hi guys, I've exhausted my  ideas on this one, and no amount of Googling seems to add the matter. I'm having...

SQL Server Database Table Size Limit - Hi, I have go through the limitations of SQL Server on the official documents but please let me know a table...


SQL Server 2017 : SQL Server 2017 - Development

Generate a unique number for a combination - How do you generate unique number based on  a Loannumber , Date columns Example Declare @loannumber Int = 1234565 ,@date Date = '12-01-2017' Declare @test...


SQL Server 2016 : SQL Server 2016 - Administration

Adding new server to AG fails, log file errors - the log in this backup set...which is too recent to apply to the database?! - Ok, I am at a lost to understand this. I am trying to add a new server to an AG.  1.  The new...

Different plan on secondary vs Primary - I have found an issue where a query plan on the secondary replica is much different than the primary? Results...

Script to Copy SSRS Content between Report Servers - Any one know where can I download the script for copying SSRS reports to another server. And does it still work...


SQL Server 2016 : SQL Server 2016 - Development and T-SQL

Trigger woes - Hi all We've got an application that inserts information into an SQL table (table A). The trigger on table A then either...


SQL Server 2014 : Administration - SQL Server 2014

Backing up to UNC path - I'd like to backup my databases to a UNC path.  IE - \\servername\share1\. I'm a bit confused about the configuration, does the...

Cant stop sql server - I couldn't add databases, so I attempted to give myself the privilege.  It wouldn't let me.  So I went to...


SQL Server 2012 : SQL 2012 - General

SQL Server agent job not working - Hi All      I am  using  Windows 2012 and SQL Server 2012.  I am trying to execute a job in SQL...

SP_UPDATESTATS vs UPDATE STATISTICS - There is a daily sp_update stats (on db which is 4TB) that is causing high CPU. To reduce the CPU,...

How would you parse 000.024.000 into 24H? - My table holds values like 000.004.000, 000.02.000, 000.024.000. What is the best/easiest way to get 4H, 2H, or 24H respectively?


SQL Server 2008 : SQL Server 2008 - General

Weeding through duplicates - Our database has a lot of duplicate records (one person with more than one record).  I'd like to write a...

Pivot interview questions - Hi Everyone, I attended a interview in top company  last week . They asked me to write a query based on following scenarios [code...

Anomaly/Question: SQL Server 2008 R2: Maintenace Plan Full backups no longer compressed. (Started happening on it's own without reason) - Today one of our production SQL Servers started behaving strangely. The daily full  backup job which runs a "Maintenance Plan" task...

automate scripting of server level objects (linked servers, jobs, logins)... but linked servers in particular - As part of a DR enhancement, I'd like to have a SQL Agent job that runs daily and writes out...


SQL Server 2008 : T-SQL (SS2K8)

HTML using XML PATH - Hi, I am generating the HTML using the XML PATH query, which is happening using the below mentioned code, the only...


Programming : Powershell

Is it possible to get permissions of attached database files via powershell? - I had a problem recently where the permissions on a database file were wrong and I wanted an automated way...

This email has been sent to newsletter@newslettercollector.com. To be removed from this list, please click here.
If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com.
This newsletter was sent to you because you signed up at SQLServerCentral.com.
Feel free to forward this to any colleagues that you think might be interested.
If you have received this email from a colleague, you can register to receive it here.
This transmission is ©2018 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
Contact: webmaster@sqlservercentral.com