如何在NAV 2015中通​​过SQL Query创建NAV用户

时间:2016-09-01 20:17:47

标签: sql sql-server sql-server-2012 navision dynamics-nav-2015

我需要通过查询从SQL Server 2012 NAV 2015 创建用户。

任何人都知道怎么做?

提前致谢。

2 个答案:

答案 0 :(得分:0)

这里的答案

通过 CMD控制台获取 Windows SID 执行

644

SQL查询:

whoami/user

答案 1 :(得分:0)

对于Dynamics NAV 2018

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

SELECT NEWID()
SET @USERNAME = ‘ServerName\Administrator’
SET @USERSID = NEWID()
SET @USERSIDTXT = CONVERT(VARCHAR(50), @USERSID)
SET @WINDOWSSID = ‘YourWindowsSID’

INSERT INTO [dbo].[User] ([User Security ID],[User Name],[Full Name],[State],[Expiry Date],[Windows Security ID],[Change Password],[License Type],[Authentication Email],[Contact Email],[ExchangeIdentifier],[Application ID]) VALUES (@USERSID,@USERNAME,”,0,’1753-01-01 00:00:00.000′,@WINDOWSSID,0,0,”,”,”,’00000000-0000-0000-0000-000000000000′)

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

INSERT INTO [dbo].[Access Control]([User Security ID],[Role ID],[Company Name],[Scope],[App ID]) VALUES (@USERSID,’SUPER’,”,’0′,’00000000-0000-0000-0000-000000000000′)
GO

我已经使用SQL 2016 + NAV 2018对其进行了测试并且可以正常工作