I've tried several different ways to do a comparison in an insert clause...can anyone assist me?.....here is some of the code (need help with code in quotations):
INSERT INTO Grants
(
PlanID, PrevGrantID, ProgramID, GrantStatusID,
IA_GrantPrjDirID, IA_GrantPrjDirSrcID, GrantPrjDirName,
DateCreated, RequestDate, BudgetDate, BudgetAmount
)
SELECT
PlanID, GrantID, ProgramID, 'B',
IA_GrantPrjDirID, IA_GrantPrjDirSrcID, GrantPrjDirName,
GetDate(), DateAdd (yyyy,1, RequestDate), @NewBudgetDate,
"Case GrantAmount
when NULL then BudgetAmount
Else GrantAmount
End"
FROM vwRollover_Grants
WHERE (((FiscalYear)= @pintPrevFY + 1 ))
The "Case" statement is the only thing I've created not giving me an error in this stored procedure. I need to insert a value based on what is stored in the Grant Amount field. If its null then I need to use the Budget Amount.
INSERT INTO Grants
(
PlanID, PrevGrantID, ProgramID, GrantStatusID,
IA_GrantPrjDirID, IA_GrantPrjDirSrcID, GrantPrjDirName,
DateCreated, RequestDate, BudgetDate, BudgetAmount
)
SELECT
PlanID, GrantID, ProgramID, 'B',
IA_GrantPrjDirID, IA_GrantPrjDirSrcID, GrantPrjDirName,
GetDate(), DateAdd (yyyy,1, RequestDate), @NewBudgetDate,
"Case GrantAmount
when NULL then BudgetAmount
Else GrantAmount
End"
FROM vwRollover_Grants
WHERE (((FiscalYear)= @pintPrevFY + 1 ))
The "Case" statement is the only thing I've created not giving me an error in this stored procedure. I need to insert a value based on what is stored in the Grant Amount field. If its null then I need to use the Budget Amount.