在ssrs中调用sql函数

在ssrs中调用sql函数,sql,sql-server,reporting-services,user-defined-functions,reportbuilder,Sql,Sql Server,Reporting Services,User Defined Functions,Reportbuilder,首先,我是一个新手,我在做什么。我有基本SQL方面的经验,但没有接受过正式培训,所以如果我完全错了,请耐心等待 我正在连接到报表生成器中的SQL User_定义函数,但在“,”附近得到了错误语法errpr错误语法。这是我正在使用的查询: SELECT TicketNo, RowNo, WeighingTicket, Material, CustomerSite, TicketDate, quantity, NetWeight, TransportCharge, DisposalC

首先,我是一个新手,我在做什么。我有基本SQL方面的经验,但没有接受过正式培训,所以如果我完全错了,请耐心等待

我正在连接到报表生成器中的SQL User_定义函数,但在“,”附近得到了错误语法errpr错误语法。这是我正在使用的查询:

SELECT        TicketNo, RowNo, WeighingTicket, Material, CustomerSite, 
TicketDate, quantity, NetWeight, TransportCharge, DisposalCharge, 
OtherCharge, >TotalCharge, CustomerName, ARAccountCode, ContainerType, 
                         worktypeid, NewAction
FROM            dbo.fn_WTG_AB_StandardSalesReport(,,) AS 
                fn_WTG_AB_StandardSalesReport_1
这是通过在查询设计器中选择函数作为表创建的-不知道为什么要重命名它

这是我的函数代码,因为这可能也是问题所在

    [dbo].[fn_WTG_AB_StandardSalesReport]
    (   
-- Add the parameters for the function here
@StartDate date,
@EndDate date,
@Account nvarchar(60)
)
RETURNS TABLE 
AS
RETURN 
(
-- Add the SELECT statement with parameter references here
SELECT TicketNo, row_number() OVER (ORDER BY worktypeid) AS RowNo, 
WeighingTicket, Material, CustomerSite, TicketDate, quantity, NetWeight, 
TransportCharge, DisposalCharge, OtherCharge, TotalCharge, 
CustomerName, ARAccountCode, ContainerType, worktypeid, CASE WHEN worktypeid 
= 3 THEN 'Gate' ELSE Action END AS NewAction
FROM            (SELECT        dbo.V_AB_StandardReportUnion.TicketNo, 
dbo.V_AB_StandardReportUnion.weighingticket, 
dbo.V_AB_StandardReportUnion.Material, 
dbo.V_AB_StandardReportUnion.CustomerSite,                                              
dbo.V_AB_StandardReportUnion.TicketDate, 
dbo.V_AB_StandardReportUnion.quantity, 
dbo.V_AB_StandardReportUnion.NetWeight, 
CASE WHEN dbo.V_AB_StandardReportUnion.TransportCharge IS NULL THEN 0 ELSE 
TransportCharge END AS TransportCharge, CASE WHEN 
dbo.V_AB_StandardReportUnion.DisposalCharge IS NULL THEN 0 ELSE 
Disposalcharge END AS DisposalCharge, CASE WHEN 
dbo.V_AB_StandardReportUnion.OtherCharge IS NULL THEN 0 ELSE OtherCharge END 
AS OtherCharge,                                                     
dbo.V_AB_StandardReportUnion.TransportCharge + 
dbo.V_AB_StandardReportUnion.DisposalCharge + 
dbo.V_AB_StandardReportUnion.OtherCharge AS TotalCharge,                                                     
dbo.V_AB_StandardReportUnion.CustomerName, 
dbo.V_AB_StandardReportUnion.ARAccountCode, dbo.ContainerType.Description AS 
ContainerType, dbo.Action.Description AS Action,                                                     
dbo.V_AB_StandardReportUnion.worktypeid
FROM            dbo.V_AB_StandardReportUnion LEFT OUTER JOIN dbo.Action ON 
dbo.V_AB_StandardReportUnion.ActionId = dbo.Action.ActionId LEFT OUTER JOIN 
dbo.ContainerType ON dbo.V_AB_StandardReportUnion.ContainerTypeId = 
dbo.ContainerType.ContainerTypeId                                                   
where TicketDate >= @StartDate and TicketDate<= @EndDate and ARaccountcode = 
@Account)AS Sub    


非常感谢您提供的任何帮助。

无法识别此语法:

FROM dbo.fn_WTG_AB_StandardSalesReport(,,) 
如果参数有默认值,则只需使用:

FROM dbo.fn_WTG_AB_StandardSalesReport()
否则,请传入:

FROM dbo.fn_WTG_AB_StandardSalesReport(NULL, NULL, NULL)

无法识别此语法:

FROM dbo.fn_WTG_AB_StandardSalesReport(,,) 
如果参数有默认值,则只需使用:

FROM dbo.fn_WTG_AB_StandardSalesReport()
否则,请传入:

FROM dbo.fn_WTG_AB_StandardSalesReport(NULL, NULL, NULL)

太棒了,谢谢!为未来着名-现在我需要在报告中设置日期,以了解接收计划的工作方式-当然,我现在有了新问题!进入一个新的线程…太棒了,谢谢!为未来着名-现在我需要在报告中设置日期,以了解接收计划的工作方式-当然,我现在有了新问题!在新的线程上。。。