All of the variables below, @Client_PK_ID, @FundingCode, etc. are required EXCEPT for @TimeStudyPercent. A client might have one, but then again, they might not, which is OK too.
If they have one, I need to pull their percent from the tbl_Clients_ClientTimeStudy. If they do not have one, then do not pull anything and the variable will be set to NULL.
The problem is, even if they do not/should not have a TS%, the sproc is being killed and nothing is put into the @Client_PK_ID variable. I have tried numerous configurations with WHERE, FROM and also the parenthesis. Some have been syntax correct, but logically wrong.
So far, so good. But the following is killing sproc even when TS% is not req'd
Following is good.
Problem continues
Should I even being using EXISTS in this situation?
As always, thanks.
Bill
If they have one, I need to pull their percent from the tbl_Clients_ClientTimeStudy. If they do not have one, then do not pull anything and the variable will be set to NULL.
The problem is, even if they do not/should not have a TS%, the sproc is being killed and nothing is put into the @Client_PK_ID variable. I have tried numerous configurations with WHERE, FROM and also the parenthesis. Some have been syntax correct, but logically wrong.
Code:
SELECT @Client_PK_ID =
tbl_Clients_ClientBasicInfo.Client_PK_ID,
@FundingCode =
tbl_Clients_ClientFundingAndProgramSources.FundingCode,
@AverageWage =
tbl_Clients_ClientWageRates.AverageWage,
@FringeWage =
tbl_Clients_ClientWageRates.FringeWage
Code:
Select @TimeStudyPercent =
tbl_Clients_ClientTimeStudy.TimeStudyPercent
Following is good.
Code:
FROM tbl_Clients_ClientBasicInfo
JOIN
tbl_Clients_ClientFundingAndProgramSources
ON
tbl_Clients_ClientBasicInfo.Client_PK_ID =
tbl_Clients_ClientFundingAndProgramSources.Client_PK_ID
JOIN
tbl_Clients_ClientTimeStudy
ON
tbl_Clients_ClientBasicInfo.Client_PK_ID =
tbl_Clients_ClientTimeStudy.Client_PK_ID
JOIN
tbl_Clients_ClientWageRates
ON
tbl_Clients_ClientBasicInfo.Client_PK_ID =
tbl_Clients_ClientWageRates.Client_PK_ID
where tbl_Clients_ClientBasicInfo.ClientNumber = @ClientNumber
Problem continues
Code:
AND --<<also tried WHERE EXISTS
EXISTS (SELECT @TimeStudyPercent FROM
tbl_Clients_ClientTimeStudy
where tbl_Clients_ClientBasicInfo.ClientNumber = @ClientNumber)
Should I even being using EXISTS in this situation?
As always, thanks.
Bill