0

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

有人知道怎么做吗?

提前致谢。

4

2 回答 2

1

对于动态资产净值 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],[Exchange Identifier],[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 对其进行了测试并且可以工作

于 2019-01-24T18:39:43.797 回答
0

答案在这里

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

whoami/user

SQL查询:

USE [YourDatabase]
DECLARE @USERSID uniqueidentifier, @WINDOWSSID nvarchar(119), @USERNAME     
nvarchar(50)
SET @USERNAME   = 'Domain\user'
SET @USERSID    = newid()
SET @WINDOWSSID = 'Your SID'

INSERT INTO [dbo].[User]
      ([User Security ID],[User Name],[Full Name],[State],[Expiry Date],
       [Windows Security ID],[Change Password],[License Type],

[Authentication Email])
VALUES
      (@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])
VALUES
      (@USERSID,'','','','','1753-01-01 00:00:00.000','')

INSERT INTO [dbo].[Access Control]
      ([User Security ID],[Role ID],[Company Name])
VALUES
      (@USERSID,'SUPER','')

GO
于 2016-09-01T20:26:10.360 回答