我有一个这样的存储过程:
ALTER PROCEDURE [dbo].[T_TransactionSummary]
@startDate datetime,
@endDate datetime,
@locations nvarchar(50)
AS
BEGIN
DECLARE @fromDate datetime = CONVERT(varchar(10), @startDate, 121) + ' 00:00:00.000';
DECLARE @toDate datetime = CONVERT(varchar(10), @endDate, 121) + ' 11:59:59.999';
SELECT
COUNT(*) AS CarCount,
Location_tbl.LocName,
REPLACE(CONVERT(varchar(11), Transaction_tbl.dtime, 113), ' ', '-') AS Date_time,
CASE Transaction_tbl.Compl
WHEN 'True' THEN 'Complementary'
WHEN 'False' THEN 'Non-Complementary'
ELSE 'Other'
END AS Expr1,
VType_tbl.Vtype,
CASE
WHEN (VType_tbl.Vtype = 'Normal' AND Transaction_tbl.Compl = 'False') THEN COUNT(*) * 50
WHEN (VType_tbl.Vtype = 'VIP' AND Transaction_tbl.Compl = 'False') THEN COUNT(*) * 100
ELSE 0
END AS Total,
CASE
WHEN Transaction_tbl.Paid = 'False' THEN 0
ELSE SUM(Transaction_tbl.PAmount)
END AS CIH
FROM
Transaction_tbl INNER JOIN
Location_tbl ON (Transaction_tbl.Locid = Location_tbl.Locid) LEFT OUTER JOIN
VType_tbl ON (Transaction_tbl.vtid = VType_tbl.vtid) LEFT OUTER JOIN
Make_tbl ON (Transaction_tbl.mkid = Make_tbl.mkid) LEFT OUTER JOIN
Color_tbl ON (Transaction_tbl.Colid = Color_tbl.colid) LEFT OUTER JOIN
PlateSource_tbl ON (Transaction_tbl.PSID = PlateSource_tbl.PSID)
WHERE
(Transaction_tbl.dtime BETWEEN @fromDate AND @toDate)
AND (Location_tbl.Locid IN (SELECT locid FROM location_tbl WHERE locname IN (@locations)))
GROUP BY
Location_tbl.LocName,
REPLACE(CONVERT(varchar(11), Transaction_tbl.dtime, 113), ' ', '-'),
VType_tbl.Vtype, Transaction_tbl.Compl, Transaction_tbl.Paid
ORDER BY
Location_tbl.LocName,
Date_time DESC,
VType_tbl.Vtype,
Transaction_tbl.Compl
END
我正在传递这样的日期和位置:
@startDate = '2013-01-01',
@endDate = '2013-10-01',
@locations = 'Blooming Dale,Fashion Avenue'
但没有得到任何价值......我的存储过程有什么问题