1
我创建了一个sql 2005存储过程来告诉我,如果我正在搜索的CRID是由主管批准的。 [SuperApproved]有点儿,[CRID]是char(36)。即使CRID不存在,我仍然得到1. 任何帮助写这篇文章?存储过程是否存在没有给出正确答案
USE [cr_Saturn2]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Randy Baker
-- Create date: 10/12/2010
-- Description: Check for Approved CRID in CostReportTracking
-- =============================================
alter PROCEDURE [dbo].[st_Is_CostReportApproved]
-- Add the parameters for the stored procedure here
@myECR char(36) = null
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
if exists(
select [CRID]
from [dbo].[CostReportTracking]
where [SuperApproved] = 1)
-- exists- cost report is Approved by Supervisor
select 1
else
-- does not exist
select 0
END
哎呀 - 是的 - 我的坏!你确定无误。谢谢回复! – randy 2010-10-15 16:58:03
@randy欢迎您。如果我的回答对您有帮助,请点击左边的复选标记以接受答案。 – 2010-10-15 16:59:06