IF EXISTS ( SELECT * 
            FROM   sysobjects 
            WHERE  id = object_id(N'[dbo].[CF_SCA_ValidarPersona]') 
                   and [type] = 'FN')
BEGIN
    DROP FUNCTION dbo.CF_SCA_ValidarPersona
END
GO

CREATE FUNCTION [dbo].[CF_SCA_ValidarPersona](@pId_Cliente INT)
RETURNS TINYINT
AS
BEGIN
DECLARE @Flag_Persona_Existente		TINYINT
DECLARE @Id_Cliente					INT

SET @Flag_Persona_Existente		= 0
SET @Id_Cliente					= 0

SET @Id_Cliente = ISNULL((SELECT Id_Cliente FROM Clientes WHERE Id_Cliente = @pId_Cliente), 0)

IF (@Id_Cliente <> 0)
BEGIN
	SET @Flag_Persona_Existente = 1
END

RETURN ISNULL(@Flag_Persona_Existente, 0)

END