Hi all!
I am having probs with my SP's and was wondering if you guys can help.....
I have a set of tables (CERD, LMCD, TOF_CL_DETAILS) that has a two fields TOF_ID (INT) and UPDATE_DONE (BIT).
There are 8 tables with this arrangement, and this is where the prob comes in. The output i am looking to acheive would look like this:
TOF_ID | CERD_DONE | LMCD_DONE | TOF_CL_DETAILS_DONE
17 TRUE TRUE FALSE
I have tried this logic in SP for just one table (with the thought of replicationg it for all the others), but got myself all confused, it seems to compile fine, but does not display any output.
Can anyone help?
Cheers Andy
I am having probs with my SP's and was wondering if you guys can help.....
I have a set of tables (CERD, LMCD, TOF_CL_DETAILS) that has a two fields TOF_ID (INT) and UPDATE_DONE (BIT).
There are 8 tables with this arrangement, and this is where the prob comes in. The output i am looking to acheive would look like this:
TOF_ID | CERD_DONE | LMCD_DONE | TOF_CL_DETAILS_DONE
17 TRUE TRUE FALSE
I have tried this logic in SP for just one table (with the thought of replicationg it for all the others), but got myself all confused, it seems to compile fine, but does not display any output.
Code:
Create Procedure sp_CheckChangeID
@TOF_ID INT
As
DECLARE
@CERD_TID INT,
@CERD_PRESENT BIT
SELECT @CERD_TID = CERD.TOF_ID
FROM CERD
WHERE UPDATE_DONE = 1
AND
TOF_ID = @TOF_ID
IF @CERD_TID is null
BEGIN
SELECT @CERD_PRESENT = 1
END
ELSE
BEGIN
SELECT @CERD_PRESENT = 0
END
Can anyone help?
Cheers Andy