Código SQL:
Ver originalCREATE PROCEDURE p_ValCulture
@IDCulture NCHAR(6),
@Name nvarchar(50),
@DATE datetime,
@Operacion VARCHAR(1),
@Valida VARCHAR(250) OUTPUT
AS
BEGIN
SET @Valida = 1
IF(@IDCulture = '' OR @Name = '')
BEGIN
SET @Valida = 0
END
ELSE
BEGIN
IF (SELECT COUNT(*) FROM Production.Culture WHERE IdCulture = @IDCulture)= 0 OR
(SELECT COUNT(*) FROM Production.Culture WHERE Name = @Name)= 0
BEGIN
SET @Valida = 0
END
ELSE
BEGIN
IF(DATEDIFF ( 'dd' ,@DATE ,GETDATE())< 0)
BEGIN
SET @Valida = 0
END
END
IF(@Operacion <> 'U' OR @Operacion <> 'I' OR @Operacion <> 'D' )
BEGIN
SET @Valida = 0
END
END
RETURN
END
GO