您好,我正在尝试制作一个报表,其中列出了我们的报表服务器上的所有订阅,它们所在的报表,它们运行的时间和日期,以及当前的情况。到目前为止,我已经能够获得报告的列表和报告的时间表。我似乎无法理解明细表中的值和列的含义。
如果有人能阐明如何理解这些专栏及其价值,我将不胜感激。这就是我到目前为止得到的查询。
使用ReportServer;
去
选择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 \*/从Catalog作为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 谢谢,
克里斯
发布于 2011-04-12 07:41:13
以下是部分答案..。
DaysOfWeek与二进制设置相关,其中:
星期日是位0:值1星期一是位1:值2星期二是位2:值4星期三是位3:值8星期四是位4:值16星期五是位5:值32星期六是位6:值64
因此,如果每周一和周三运行报告,则DaysOfWeek将为2+ 8或10。
我自己目前正在做这件事,所以当我发现更多的时候,我会增加这一点。
发布于 2012-01-31 16:42:33
我有一个解决方案,因为它出现在我正在撰写的报告中。
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
endhttps://stackoverflow.com/questions/3876572
复制相似问题