Проблема такая. Есть новый сервис (табличка, запрос, датасет и т.д.)
В запросе колонки с вручную написанным sql-запросом. Под админом всё в порядке, а пользователи не видят. Читал, что нужно через view делать, но всё равно не работает.
SELECT TOP 40
[tbl_Stat].[ID] AS [ID],
[tbl_Stat].[CreatedOn] AS [CreatedOn],
[tbl_Stat].[CreatedByID] AS [CreatedByID],
[CreatedBy].[Name] AS [CreatedByName],
[tbl_Stat].[ModifiedOn] AS [ModifiedOn],
[tbl_Stat].[ModifiedByID] AS [ModifiedByID],
[ModifiedBy].[Name] AS [ModifiedByName],
[tbl_Stat].[Name] AS [Name],
[tbl_Stat].[Description] AS [Description],
[tbl_Stat].[TypeID] AS [TypeID],
[Type].[Name] AS [TypeName],
[tbl_Stat].[OwnerID] AS [OwnerID],
(SELECT Sum(Amount) AS [Amount2]
FROM [dbo].[vw_Invoice] AS [tbl_In]
WHERE([tbl_In].[OwnerID] = [tbl_Stat].[ID] AND
[tbl_In].[InvoiceDate] >= :StartDate AND
[tbl_In].[InvoiceDate] :FinishDate))
AS [CustomSQLColumn1],
( SELECT
sum(PaymentAmount) AS [CustomSQLColumn]
FROM
[dbo].[vw_Invoice] AS [tbl_In]
WHERE([tbl_In].[OwnerID] = [tbl_Stat].[ID] AND
[tbl_In].[PaymentDate] >= :StartDate AND
[tbl_In].[PaymentDate] :FinishDate)) AS [CustomSQLColumn2],
(SELECT
sum(PaymentAmount2) AS [CustomSQLColumn]
FROM
[dbo].[vw_Invoice] AS [tbl_In]
WHERE([tbl_In].[OwnerID] = [tbl_Stat].[ID] AND
[tbl_In].[PaymentDate2] >= :StartDate AND
[tbl_In].[PaymentDate2] :FinishDate)) AS [CustomSQLColumn3],
(SELECT
Count (*) AS [CustomSQLColumn]
FROM
[dbo].[vw_Invoice] AS [tbl_In]
WHERE([tbl_In].[OwnerID] = [tbl_Stat].[ID] AND
[tbl_In].[InvoiceDate] >= :StartDate AND
[tbl_In].[InvoiceDate] :FinishDate)) AS [CustomSQLColumn4],
(SELECT
Sum (Zakaz) AS [CustomSQLColumn1]
FROM
[dbo].[vw_Document] AS [tbl_Doc]
WHERE([tbl_Doc].[OwnerID] = [tbl_Stat].[ID] AND
[tbl_Doc].[Date] >= :StartDate AND
[tbl_Doc].[Date] :FinishDate)) AS [CustomSQLColumn5],
(SELECT
Sum(PublicationsAmount) AS [CustomSQLColumn]
FROM
[dbo].[vw_Document] AS [tbl_Doc]
WHERE([tbl_Doc].[OwnerID] = [tbl_Stat].[ID] AND
[tbl_Doc].[Date] >= :StartDate AND
[tbl_Doc].[Date] :FinishDate)) AS [CustomSQLColumn6],
(SELECT
Count (*) AS [CustomSQLColumn]
FROM
[dbo].[vw_Task] AS [tbl_Ta]
WHERE([tbl_Ta].[OwnerID] = [tbl_Stat].[ID] AND
[tbl_Ta].[DueDate] :FinishDate AND
[tbl_Ta].[StatusID] > :StatusID1 AND
[tbl_Ta].[StatusID] > :StatusID2)) AS [CustomSQLColumn7],
(SELECT
Count(*) AS [CustomSQLColumn]
FROM
[dbo].[vw_Account] AS [tbl_Acc]
WHERE([tbl_Acc].[OwnerID] = [tbl_Stat].[ID] AND
[tbl_Acc].[CreatedOn] >= :StartDate AND
[tbl_Acc].[CreatedOn] :FinishDate)) AS [CustomSQLColumn8],
(SELECT
Count (*) AS [CustomSQLColumn]
FROM
[dbo].[vw_Task] AS [tbl_Ta]
WHERE([tbl_Ta].[OwnerID] = [tbl_Stat].[ID] AND
[tbl_Ta].[CreatedOn] >= :StartDate AND
[tbl_Ta].[CreatedOn] :FinishDate)) AS [CustomSQLColumn9],
(SELECT
count(*) AS [CustomSQLColumn]
FROM
[dbo].[vw_Account] AS [tbl_Acc]
WHERE([tbl_Acc].[OwnerID] = [tbl_Stat].[ID] AND
[tbl_Acc].[CreatedOn] :FinishDate)) AS [CustomSQLColumn10]
FROM
[dbo].[tbl_Stat] AS [tbl_Stat]
LEFT OUTER JOIN
[dbo].[tbl_Contact] AS [CreatedBy] ON [CreatedBy].[ID] = [tbl_Stat].[CreatedByID]
LEFT OUTER JOIN
[dbo].[tbl_Contact] AS [ModifiedBy] ON [ModifiedBy].[ID] = [tbl_Stat].[ModifiedByID]
LEFT OUTER JOIN
[dbo].[tbl_StatType] AS [Type] ON [Type].[ID] = [tbl_Stat].[TypeID]