Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 update column values in temporary table

Author  Topic 

k886015
Starting Member

3 Posts

Posted - 2009-07-29 : 15:48:00
I have a temporary table created where Grp_Rpt_Fin_Arrangement_Size_Cd was originally set at ' '. I now need to populate that column based on other values within the table. I keep getting and error message about line 6 near '=' and I can't determine the issue. HELP!

UPDATE GroupArrangement
SET Grp_Rpt_Fin_Arrangement_Size_Cd =
CASE
If Financial_Arrangement_Code = 'FI' then
CASE
If Mbr_Facility_Month_End_Total_Cnt = 2.00 then Grp_Rpt_Fin_Arrangement_Size_Cd = '1 '
else
If Mbr_Facility_Month_End_Total_Cnt > 1.00 and Mbr_Facility_Month_End_Total_Cnt < 51.00 then Grp_Rpt_Fin_Arrangement_Size_Cd = '2 ';
else
If Mbr_Facility_Month_End_Total_Cnt > 50.00 and Mbr_Facility_Month_End_Total_Cnt < 101.00 then Grp_Rpt_Fin_Arrangement_Size_Cd = '3 ';
else
I Mbr_Facility_Month_End_Total_Cnt > 100.00 and Mbr_Facility_Month_End_Total_Cnt < 250.00 then Grp_Rpt_Fin_Arrangement_Size_Cd = '4 ';
else
If Mbr_Facility_Month_End_Total_Cnt > 249.00 and Mbr_Facility_Month_End_Total_Cnt < 750.00 then Grp_Rpt_Fin_Arrangement_Size_Cd = '5 ';
else
If Mbr_Facility_Month_End_Total_Cnt > 749.00 then Grp_Rpt_Fin_Arrangement_Size_Cd = '6 ';
end;
else '_'
end;

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-29 : 16:26:20
[code]UPDATE GroupArrangement
SET Grp_Rpt_Fin_Arrangement_Size_Cd = CASE
WHEN Mbr_Facility_Month_End_Total_Cnt = 2.00 THEN '1 '
WHEN Mbr_Facility_Month_End_Total_Cnt > 1.00 AND Mbr_Facility_Month_End_Total_Cnt < 51.00 THEN '2 '
WHEN Mbr_Facility_Month_End_Total_Cnt > 50.00 AND Mbr_Facility_Month_End_Total_Cnt < 101.00 THEN '3 '
WHEN Mbr_Facility_Month_End_Total_Cnt > 100.00 AND Mbr_Facility_Month_End_Total_Cnt < 250.00 THEN '4 '
WHEN Mbr_Facility_Month_End_Total_Cnt > 249.00 AND Mbr_Facility_Month_End_Total_Cnt < 750.00 THEN '5 '
WHEN Mbr_Facility_Month_End_Total_Cnt > 749.00 THEN '6 '
END
WHERE Financial_Arrangement_Code = 'FI'

UPDATE GroupArrangement
SET Grp_Rpt_Fin_Arrangement_Size_Cd = '_'
WHERE Financial_Arrangement_Code <> 'FI'[/code]


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -