即使数据库有匹配的记录,以下存储过程也不会返回任何内容。Rowcount
是问题吗?有人请帮忙吗?
ALTER PROCEDURE [dbo].[Usp_get_product_rates]
-- Add the parameters for the stored procedure here
@pcat1 CHAR(3),
@pcat2 CHAR(3),
@pcat3 CHAR(1)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON
SELECT b.pcat1,
b.pcat2,
pcat3,
rate1,
rate2
FROM Product_Rates AS a
JOIN Master_Rates AS b
ON a.pon = b.pon
WHERE b.pcat1 = @pcat1
AND b.pcat2 = @pcat2
AND pcat3 = 'P'
IF @@RowCount = 0
BEGIN
SELECT b.npa,
b.nxx,
blockid,
Inter_state_rate,
Intra_state_rate
FROM Rates_STF2 AS a
JOIN TPM AS b
ON a.pon = b.pon
WHERE b.pcat1 = @pcat1
AND b.pcat2 = @pcat2
AND pcat3 = '@pcat3'
END
END