How to update the Max Memory at SQL Server?

From the command prompt start sqlCmd using the Dedicated Administrator Connection (DAC). :

net start MSSQLServer /mSQLCMD /f

C:>sqlcmd -S ServerName -U sa -P –A

Once you are connected, execute the following to set the memory to 4 GB, it should be enough to allow you to reconnect using the Management Studio tool.

sp_configure 'show advanced options', 1;
sp_configure 'max server memory', 4096;

Issues can be fixed by above process:
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .

There is insufficient system memory to run this query.

Accidentally turned down SQL memory too low to log in, how do I fix?

How to use CLR function at SQL Server?

Creating a CLR function in SQL Server involves the following steps:
1. Define the function as a static method of a class in a language supported by the .NET Framework
2. Register the assembly in SQL Server by using the CREATE ASSEMBLY statement
3. Create the function that references the registered assembly by using the CREATE FUNCTION statement

1. a. Create a SQL Server Project using Visual Studio 2019 or Higher, Named the Project SQLExternalMethods
b. Create a Class MySQLFunctions
c. Add a static Method with SQL function Attribute
namespace SQLExternalMethods
public static class MySQLFunctions
public static SqlString Test(string myString )
return myString .ToUpper();

2. a. Build the Above project and copy the SQLExternalMethods .dll to SQL server Installed Server.
b. Open SSMS and Register the assembly
FROM 'C:\Program Files (x86)\LLM\ SQLExternalMethods .dll ';

3. Now create a SQL function to use the c# methods
CREATE FUNCTION MyToUpper(@myString nvarchar(max)) RETURNS nvarchar(max)
EXTERNAL NAME SQLExternalMethods . MySQLFunctions .Test ;

How to enable “Windows Authentication” for your websites?

There are few things which we need to do before access the website using windows authentication.


Add or replace existing Authentication Tag

IIS Express with Visual Studio:

  • Click on your project in the Solution Explorer to select the project.
  • Open Properties pane suing F4.
  • In the Properties pane for your project:
    a) Set “Anonymous Authentication” to “Disabled”.
    b) Set “Windows Authentication” to “Enabled”.

IIS 7 or later:

  • Open IIS Manager and navigate to your website.
  • In Features View, double-click Authentication.
  • On the Authentication page, select Windows authentication. If Windows authentication is not an option, you’ll need to make sure Windows authentication is installed on the server.

To enable Windows authentication on Windows Desktop:

  • In Control Panel open “Programs and Features”.
  • Select “Turn Windows features on or off”.
  • Navigate to Internet Information Services > World Wide Web Services > Security and make sure the Windows authentication node is checked.

To enable Windows authentication on Windows Server:

  • In Server Manager, select Web Server (IIS) and click Add Role Services.
  • Navigate to Web Server > Security and make sure the Windows authentication node is checked.