了解 ReportServer.dbo.Schedule 表

发布于 2024-09-26 17:54:34 字数 868 浏览 3 评论 0原文

您好,我正在尝试制作一份报告,其中列出了我们的报告服务器上的所有订阅、它们所在的报告、它们运行的​​时间和日期以及重复率。到目前为止,我已经能够获得报告清单和报告时间表。我似乎无法理解 Schedule 表中的值和列的含义。

如果有人能够阐明如何理解这些专栏及其价值,我将非常感激。这是我到目前为止的疑问。

使用报表服务器;
转到

选择用户.用户名
, c.Name AS 报告
, 订阅.说明
,时间表。*
/* , Schedule.RecurrenceType
, Schedule.MinutesInterval
, Schedule.DaysInterval
, Schedule.WeeksInterval
, Schedule.DaysOfWeek
, Schedule.DaysOfMonth
,时间表。[月]
, Schedule.MonthlyWeek */
FROM [目录] AS c
INNER JOIN 订阅
ON c.ItemId = Subscriptions.Report_OId
内连接用户
ON Subscriptions.OwnerId = Users.UserId
INNER JOIN 报告计划
ON Subscriptions.SubScriptionId = ReportSchedule.SubScriptionId
内连接时间表
ON ReportSchedule.ScheduleId = Schedule.ScheduleId

谢谢,
克里斯

Hi I am trying to make a report that lists all the subscriptions on our report server, the report they are on, the times and days they are run on, and the reccurence. So far I have been able to get a list of the reports and schedules of the reports. I cannot seem to understand what the values and columns in the Schedule table mean.

If anyone could shed some light on how to make sense of these columns and their values, I would really appreciate it. This is the query I have so far.

USE ReportServer;
GO

SELECT Users.UserName
, c.Name AS Report
, Subscriptions.Description
, Schedule.*
/* , Schedule.RecurrenceType
, Schedule.MinutesInterval
, Schedule.DaysInterval
, Schedule.WeeksInterval
, Schedule.DaysOfWeek
, Schedule.DaysOfMonth
, Schedule.[Month]
, Schedule.MonthlyWeek */
FROM [Catalog] AS c
INNER JOIN Subscriptions
ON c.ItemId = Subscriptions.Report_OId
INNER JOIN Users
ON Subscriptions.OwnerId = Users.UserId
INNER JOIN ReportSchedule
ON Subscriptions.SubScriptionId = ReportSchedule.SubScriptionId
INNER JOIN Schedule
ON ReportSchedule.ScheduleId = Schedule.ScheduleId

Thanks,
Chris

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

呆头 2024-10-03 17:54:34

这是部分答案...

DaysOfWeek 与二进制设置相关,其中:

星期日是位 0:值为 1
星期一是位 1:值 2
星期二是位 2:值 4
星期三是位 3:值为 8
星期四是位 4:值为 16
星期五是位 5:值为 32
星期六是位 6:值为 64

因此,如果报表每周一和周三运行,则 DaysOfWeek 将是 2 + 8,或 10。

我目前正在自己​​处理此问题,因此当我发现更多信息时,我将对此进行添加。

Here is a partial answer...

DaysOfWeek relate to the binary setting where:

Sunday is bit 0: Value of 1
Monday is bit 1: Value of 2
Tuesday is bit 2: Value of 4
Wednesday is bit 3: Value of 8
Thursday is bit 4: Value of 16
Friday is bit 5: Value of 32
Saturday is bit 6: Value of 64

So if the report is run every Monday and Wednesday, the DaysOfWeek will be 2 + 8, or 10.

I am currently working on this myself so I will add to this as I discover more.

迷迭香的记忆 2024-10-03 17:54:34

我对此有一个解决方案,因为它出现在我正在撰写的报告中。

create function [dbo].[calendarlist](@Value_in as int,@Type as int) returns varchar(200)
as
begin

/*
This code is to work out either the day of the week or the name of a month when given a value
Wrriten by S Manson.
31/01/2012
*/

declare @strings as varchar(200)
declare @Count int

if @Type = 2    --Months
    Begin
        set @Count =12
    end
else if @Type = 1   --Days of Week
    Begin
        Set @Count = 7
    End
else    --Days of Month
    Begin
        Set @Count = 31
    End

set @strings = ''

while @Count<>0
begin
    if @Value_in>=(select power(2,@count-1))
        begin
            set @Value_in = @Value_in - (select power(2,@count-1))
            If @Type=2
                Begin
                    set @strings = (SELECT DATENAME(mm, DATEADD(month, @count-1, CAST('2008-01-01' AS datetime)))) + ',' + @strings
                end
            else if @Type = 1
                begin
                    set @strings = (SELECT DATENAME(dw, DATEADD(day, @count-1, CAST('2012-01-01' AS datetime)))) + ',' + @strings
                end
            else
                begin
                    set @strings = convert(varchar(2),@Count) + ', ' + @strings
                end

        end
    set @count = @count-1
end
if right(@strings,1)=','
    set @strings = left(@strings,len(@strings)-1)

return @strings

end

I have a solution for this as it came up for a report I am writing.

create function [dbo].[calendarlist](@Value_in as int,@Type as int) returns varchar(200)
as
begin

/*
This code is to work out either the day of the week or the name of a month when given a value
Wrriten by S Manson.
31/01/2012
*/

declare @strings as varchar(200)
declare @Count int

if @Type = 2    --Months
    Begin
        set @Count =12
    end
else if @Type = 1   --Days of Week
    Begin
        Set @Count = 7
    End
else    --Days of Month
    Begin
        Set @Count = 31
    End

set @strings = ''

while @Count<>0
begin
    if @Value_in>=(select power(2,@count-1))
        begin
            set @Value_in = @Value_in - (select power(2,@count-1))
            If @Type=2
                Begin
                    set @strings = (SELECT DATENAME(mm, DATEADD(month, @count-1, CAST('2008-01-01' AS datetime)))) + ',' + @strings
                end
            else if @Type = 1
                begin
                    set @strings = (SELECT DATENAME(dw, DATEADD(day, @count-1, CAST('2012-01-01' AS datetime)))) + ',' + @strings
                end
            else
                begin
                    set @strings = convert(varchar(2),@Count) + ', ' + @strings
                end

        end
    set @count = @count-1
end
if right(@strings,1)=','
    set @strings = left(@strings,len(@strings)-1)

return @strings

end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文