/****** Object: StoredProcedure [dbo].[P_GetBlacklist] Script Date: 03/10/2018 09:47:19 ******/ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[P_GetBlacklist]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[P_GetBlacklist] GO /****** Object: StoredProcedure [dbo].[P_GetBlacklist] Script Date: 03/10/2018 09:47:19 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[P_GetBlacklist] ( @Tel NVARCHAR(50), @Callid NVARCHAR(50) ) AS BEGIN SET NOCOUNT ON; declare @c int=0; select top 1 @c=COUNT(1) from T_Call_Blacklist where isnull(F_TelPhone,'')like '%'+@Tel+'%' and F_IsDelete=0 and getdate() between F_SetTime and F_RemoveTime if @c>0 begin update T_Call_CallRecords set CallState=1,DealType=1,IsDeal=1 where CallId=@Callid update T_Call_Blacklist set F_InterceptNum=F_InterceptNum+1 where isnull(F_TelPhone,'')like '%'+@Tel+'%' and F_IsDelete=0 and getdate() between F_SetTime and F_RemoveTime end select @c as BlackListVerify END GO