作者:书友85467040 | 来源:互联网 | 2023-05-17 13:30
IhavethefollowingstoredprocedurethatisbeingcalledinC#:我有以下在C#中调用的存储过程:ALTERPROCEDURE
I have the following stored procedure that is being called in C#
:
我有以下在C#中调用的存储过程:
ALTER PROCEDURE [dbo].[GetJobStatusSummary] @FiscalYear int,
@JobIDList varchar(max)
AS
SELECT
SUM(CASE StatusID
WHEN 5 THEN 1
ELSE 0
END) AS Completed,
SUM(CASE StatusID
WHEN 5 THEN 0
ELSE 1
END) AS Incomplete
FROM Review
WHERE FiscalYear = @FiscalYear
AND JobID + '|' + Position IN (SELECT
Argument
FROM dbo.CreateInClause(@JobIDList))
GROUP BY FiscalYear
When I pass in the following (this was taken from SQL Server Management Studio):
当我传入以下内容时(这是从SQL Server Management Studio中获取的):
DECLARE @return_value int
EXEC @return_value = [dbo].[GetJobStatusSummary] @FiscalYear = 2015,
@JobDList = N'00304730,00334573,00635385,'
SELECT
'Return Value' = @return_value
GO
I'm not getting anything back for Completed or Incomplete, just a return value of 0. I've verified there is in fact data in the database pertaining to these Job ID's. I'm not that skilled at SQL, as I've sort of inherited this project. The stored procedure hasn't changed, so I'm not sure what I'm missing. Any ideas?
我没有收到任何已完成或未完成的任何内容,只返回值为0.我已经确认数据库中存在与这些作业ID相关的数据。我不熟悉SQL,因为我继承了这个项目。存储过程没有改变,所以我不确定我缺少什么。有任何想法吗?
Edit: Sample of data from the table, is this useful? The ID's I'm using to test are not represented here, but this is an example of the data in there
编辑:表格中的数据样本,这有用吗?我用来测试的ID没有在这里表示,但这是其中数据的一个例子
JobID StatusID FiscalYear CreatedDT LastUpdatedDT
14999 5 2011 55:15.4 12:15.3
163511 2 2011 08:20.6 12:15.3
4 个解决方案