Category: Microsoft SQL

Create New Microsoft SQL Administrative Login
article #1160, updated 361 days ago

Often one will find a Microsoft SQL server with no working or available administrative login. To set one up:

  1. Stop the database. You’ll need its name. Go to services.msc , find entry “SQL Server (XYZ)”; XYZ is the name.
  1. Set up the database to run in single-user mode. Take the executable line in Services Manager for the SQL server, add “-m” to the end (no spaces, no quotes), and run it in a new administrative CMD. An example:
    "E:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Binn\sqlservr.exe" -sXYZ -m
  1. From another administrative command prompt, run the command-line client:

This may take multiple attempts. The attempts may error saying “Reason: Server is in single user mode. Only one administrator can connect at this time.” You may need to stop and restart the server. Sometimes the server just takes a while to reach functionality. Eventually the client will connect will connect and give you the prompt:

  1. Enter the following, press Enter at every line, and choose something long and horrible for PasswordText:
  1. Reverse the change in SQL Server Configuration Manager.
  1. Restart the SQL server.



Latest Cumulative Update to SQL Server 2017
article #1328, updated 1726 days ago

Microsoft is no longer doing Service Packs for SQL Server, they’re doing Cumulative Updates. This page reports to be listing the most current for SQL 2017:



Lost password for Microsoft SQL
article #999, updated 2788 days ago

Excellent procedure here:



Shrinking huge LDF files in Microsoft SQL
article #993, updated 2809 days ago

There is a lot of talk about this on the wild Web. This situation occurs because some instances of Microsoft SQL default to “FULL” logging mode, and this can be very helpful because if there is a crash, the database can be restored to the very transactional instant of the crash. In “FULL” logging mode, the LDF file keeps on piling up until an SQL-aware system backup is performed, at which time the LDF is pared down automatically.

But there are many SQL databases out there where we don’t care about transaction-level restore, where the backup is system image-wide and we are very happy with that level of restoration. In this case, “FULL” logging mode is very wasteful, because since the backup is not SQL-aware, the LDF file keeps on piling and piling, taking many gigabytes of disk space.

For these we want “SIMPLE” logging mode. To set this up, log into SQL Studio using an appropriately high-privileged user, and run this query substituting database_name appropriately:

USE master;

Two things are accomplished by the above. First, the LDF will quit piling. Second, a CHECKPOINT was done, which tells SQL Studio immediately that most of the space in the huge LDF is wasted. This means that you can tell SQL Studio to shrink the LDF, eliminating the wasted space, like this:

  • In Databases, right-click on the database whose LDF needs shrinking
  • Click Tasks —> Shrink —> Files.
  • In File type, choose Log.
  • Make sure “Release unused space” is selected. The other numbers will make it obvious how much space you are freeing up. If they’re not good, you have something else wrong or undone!
  • Click OK. The shrinkage will begin. Depending on how much is to be done, it may take a while, but the progression will show up in free disk space recorded in CMD.