/****** Object: StoredProcedure [dbo].[P_GetIVRWelcomes] Script Date: 01/02/2018 16:09:35 ******/ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[P_GetIVRWelcomes]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[P_GetIVRWelcomes] GO /****** Object: StoredProcedure [dbo].[P_GetIVRWelcomes] Script Date: 01/02/2018 16:09:35 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[P_GetIVRWelcomes] AS BEGIN SET NOCOUNT ON; declare @words varchar(50); declare @isw int=0; select top 1 @words=F_Content from [12345].[dbo].[T_Sys_IVRWords] where isnull(F_IsState,0)=1 and (F_StartDate<=getdate() and F_EndDate>=getdate()) if ISNULL(@words,'')!='' begin set @isw=1 end select @isw as isw,@words as words END GO