我想删除 SSRS 中的一些用户。 我尝试运行的地方:
DELETE FROM dbo.Users
WHERE dbo.Users.UserName = 'domain\user'
我收到以下错误:
Msg 547, Level 16, State 0, Line 1
The DELETE statement conflicted with the REFERENCE constraint
"FK_Catalog_CreatedByID". The conflict occurred in database "ReportServer",
table "dbo.Catalog", column 'CreatedByID'.
The statement has been terminated.
如何从 SSRS 数据库中删除用户(及其所有权限?
最佳答案
我遇到了同样的问题,我想从 SSRS 数据库中永久删除用户。所以我做了这个 SQL 语法(之前备份你的数据库!):
DECLARE @username varchar(255); SET @username = '<username>';
DECLARE @ownerid uniqueidentifier; SET @ownerid = (SELECT UserID FROM Users WHERE UserName = @username)
BEGIN TRAN
UPDATE Subscriptions SET ModifiedByID = OwnerID WHERE ModifiedByID = @ownerid
DELETE FROM Subscriptions WHERE OwnerID = @ownerid
DELETE FROM Schedule WHERE CreatedById = @ownerid
DELETE FROM PolicyUserRole WHERE UserID = @ownerid
DELETE FROM Users WHERE UserID = @ownerid
COMMIT
替换 <username>
与您要删除的用户一起,仅此而已。但请注意,这也会删除该用户的其他数据。
关于reporting-services - 如何使用TSQL删除SSRS中的用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30208244/