Home Forums SQL Server 2008 SQL Server Newbies Create UDF (Function) with one parameter - returns True/False from VBA code RE: Create UDF (Function) with one parameter - returns True/False from VBA code

  • Thanks! I didn't think about that. (where is my V8 icon).

    I was busy cobbling this together when you responded.

    The Rule Engine components are designed to return each of the 100 Base Rules as a True - False based on Query criteria.

    Let me try that out and come back to mark it as an anwser.

    CREATE FUNCTION dbo.Rule71(@ID_Wells int) RETURNS int

    AS

    BEGIN;

    DECLARE @Result int;

    SET @Result = SELECT COUNT(*) AS "SELECT Wells.ID_Wells, Wells.Well_Name, Wells.ClassificationID FROM Wells WHERE (((Wells.ID_Wells)=" & @ID_Wells & ") AND ((Wells.ClassificationID)=3));

    IF @Result = 0

    Return 0; -- False

    else

    Return 1; -- True

    end;

    END;

    go

    SELECT R_71, dbo.Rule71(ID_Wells) AS Rule71

    FROM dbo.StatusTable;