I moved on and could not figure-out why this wasn't working. I did a direct SQL Query against the draft database with the following query:
CREATE PROCEDURE [dbo].[spPSA_DRAFT_MSP_Projects__Get_Proj_CheckOutBy]
@p_char_Project_Name char(220)
,@p_i_Is_Checked_Out int OUT
,@p_gud_Proj_CheckOutBy uniqueidentifier OUT
,@p_dttm_Proj_CheckOutDate datetime OUT
,@p_io_RowCnt int OUT
,@p_io_Is_Error int OUT
AS
/*
DECLARE @return_value int,
@p_i_Is_Checked_Out int,
@p_gud_Proj_CheckOutBy uniqueidentifier,
@p_dttm_Proj_CheckOutDate datetime,
@p_io_RowCnt int,
@p_io_Is_Error int
EXEC @return_value = [dbo].[spPSA_DRAFT_MSP_Projects__Get_Proj_CheckOutBy]
@p_char_Project_Name = N'test22', -- New Template Test test22
@p_i_Is_Checked_Out = @p_i_Is_Checked_Out OUTPUT,
@p_gud_Proj_CheckOutBy = @p_gud_Proj_CheckOutBy OUTPUT,
@p_dttm_Proj_CheckOutDate = @p_dttm_Proj_CheckOutDate OUTPUT,
@p_io_RowCnt = @p_io_RowCnt OUTPUT,
@p_io_Is_Error = @p_io_Is_Error OUTPUT
SELECT @p_i_Is_Checked_Out as N'@p_i_Is_Checked_Out',
@p_gud_Proj_CheckOutBy as N'@p_gud_Proj_CheckOutBy',
@p_dttm_Proj_CheckOutDate as N'@p_dttm_Proj_CheckOutDate',
@p_io_RowCnt as N'@p_io_RowCnt',
@p_io_Is_Error as N'@p_io_Is_Error'
SELECT 'Return Value' = @return_value
*/
BEGIN
SET NOCOUNT ON;
SET @p_i_Is_Checked_Out = 0
SELECT
@p_gud_Proj_CheckOutBy = Proj_CheckOutBy
,@p_dttm_Proj_CheckOutDate = Proj_CheckOutDate
-- INTO #temp_EDB_Lkup_Tables_One_1
FROM [OWNER-PC\SQLEXPRESS].Emerson_ProjectServer_Draft.dbo.MSP_Projects
WHERE Proj_Name = @p_char_Project_Name
SET @p_io_RowCnt = @@ROWCOUNT
SET @p_io_Is_Error = @@error
if ( @p_io_RowCnt = 0 )
BEGIN
SET @p_i_Is_Checked_Out = 0
END
if ( @p_io_RowCnt > 1 )
BEGIN
SET @p_i_Is_Checked_Out = 0
SET @p_io_Is_Error = 99
END
if ( @p_io_RowCnt = 1 )
BEGIN
if ( @p_gud_Proj_CheckOutBy IS NULL )
BEGIN
SET @p_i_Is_Checked_Out = 0
END
else
BEGIN
SET @p_i_Is_Checked_Out = 1
END
END
END -- end program
Should be a no-brainer ... even for a newbie like me.
I am looking directly in the Draft Database Table=MSP_Projects
I can see that there are projects that are not null
in the column Proj_CheckOutBy. (They have GUIDs) in them.
So why is Project.IsProj_CheckOutByNull() ALWAYS returning
true whether the column has a GUID or is equal to NULL.