Skip to main content

NAV 2013 & NAV 2013 R2 - You do not have access to Microsoft Dynamics NAV - Create User From SQL.

Hi all,

This post is based on suggestion from +Ami Paneri Upadhyay

* The Screen Shots and Query Applies - TO NAV 2013 R2. Steps Remain Same for NAV 2013 but query will get change.

* The Query for NAV 2013 can be found in my Skydrive, Link at the end of the post.

Let's see what was required and how we can achieve it.


I received a database from customer and my windows login is not there in the database. I don't want to delete Customer Users from the database but want to add myself in the Users. How can we do this?


We have a database internally for development. All the consultants having User ID's in the database are not available. I want to access the database, How can i achieve it?

If you are using NAV 2013 R2 or Higher Please refer this article.

What is the Error message?

Where i try to open the database i get below error from Role Tailored Client -

You do not have access to Microsoft Dynamics NAV. Verify that you have been set up as a valid user in Microsoft Dynamics NAV.

What we Want?

A) Add My Windows Login Details in User Table & User Property Table.
B) Add Role to My User in Access Control Table.

What are the Fields that are required to be filled in?


Below are the fields in USER TABLE.

The Problem that i see in this field list is of Field "Windows Security ID".

B) USER Property TABLE-

Below are the fields from USER Property Table.

All fields Look Good in this Table.

C)  Access Control Table -

Below are the fields from Access Control Table.

All fields Look Good in this Table.

So let's see How can i get "Windows Security ID" for my ID so that i can add same in User Table.

STEP 1 - HOW TO GET Windows Security ID or SSID

You can find so many ways to find it, but i find the Powershell as easy tool to find it.

1. Open Powershell.

2. Copy Below command in Command Window.
# Author - Saurav Dhyani
# BLOG -
# Replace YourDomain\Your ID with your Domain Name & User Name

$objUser = New-Object System.Security.Principal.NTAccount("YourDomain\Your ID")

$strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])

Replace YourDomain\Your ID with Your Domain and USER ID.

Run the Command and in the Output Window you can see your SSID, as shown below.

Copy and Save the SSID, we will require it further.

STEP 2 - ENTER USER Details in NAVISION Database with Roles.

1. Open SQL Server Management Studio.

2. In My Case the database that i want to get access is Demo Database NAV (7-1).

3. Click on New Query and paste below listed command in the query window.

-- Author - Saurav Dhyani
-- BLOG -
-- APPLIES TO - NAV 2013 R2
-- Replace
-- DATABASE NAME - with your database name
-- YourDomain\Your ID - with your Domain Name & User Name
-- Your SSID - with SSID as copied in STEP 1


DECLARE @USERSID uniqueidentifier, @WINDOWSSID nvarchar(119), @USERNAME nvarchar(50), @USERSIDTXT varchar(50)

SET @USERNAME   = 'YourDomain\Your ID'

INSERT INTO [dbo].[User]
          ([User Security ID],[User Name],[Full Name],[State],[Expiry Date],[Windows Security ID],[Change Password],[License Type]
          ,[Authentication Email])
          (@USERSID,@USERNAME,'',0,'1753-01-01 00:00:00.000',@WINDOWSSID,0,0,'')

INSERT INTO [dbo].[User Property]
          ([User Security ID],[Password],[Name Identifier],[Authentication Key],[WebServices Key],[WebServices Key Expiry Date],
          [Authentication Object ID])
          (@USERSID,'','','','','1753-01-01 00:00:00.000','')

INSERT INTO [dbo].[Access Control]
          ([User Security ID],[Role ID],[Company Name])

DATABASE NAME - with your database name
YourDomain\Your ID - with your Domain Name & User Name
Your SSID - with SSID as copied in STEP 1

Execute the Query and result we be something like as shown below.

Now if i try to Run the windows client i will be able to access same.

* The Query provide SUPER Role to user, if required you can change the Role in the Last part of the query.

THE Power shell command & SQL Queries can be downloaded from my SKYDRIVE.

File Names in Sky Drive - NAV 2013 & NAV 2013 R2 Add User to Database.rar

The Zip Folder Contain Below Listed Files -

-- Power Shell Command  - (Applies to NAV 2013 & NAV 2013 R2)
-- SQL Query - (Applies to NAV 2013)
-- SQL Query - (Applies to NAV 2013 R2)

Your Commands and feedback are much appreciated.

Thanks & Regards,
Saurav Dhyani


Popular posts from this blog

Send Mail with Attachment From Navision.

Hi all, We have seen how to save a report into PDF and how to send mail to a customer. Let's link these two post in one i.e. Mailing statement to a customer into PDF Format. This article is part of the Series. Please Refer  Table of Content here . If you have the old objects set let me brief you what I will be changing - 

Dynamics 365 Business Central 2021 release wave 2 (BC19) Released.

Hi Readers, As we all were expecting Microsoft have Released Business Central 2021 Release Wave 2 Today a.k.a BC19. In this article we will see what all is announced with the General Availability.  Starting Today Customers & Partners can start using Business Central 19. #msdyn365bc #bc19

Navision Cannot generate SSPI context State ID HY000

Hi all, Sometime while trying to connect database in classic client with windows authentication or connect to Role Tailored Client we face an error message. Error - The following ODBC error occurred: Error: [Microsoft][ODBC SQL Server Driver]Cannot generate SSPI context  State ID: HY000