jasonsalas
IS-IT--Management
Hi everyone,
I'm trying to run an UPDATE sproc en masse to tally the results of a voting app I built for the upcoming NCAA March Madness tournament. I'm trying to update a master table with the value of a computed column.
If two fields match (SELECTEDWINNERS and REALLIFEWINNERS), then the value of an INT field, TOTALTALLY, is multiplied by the value of POINTVALUE.
I tried this, to no avail:
UPDATE (
SELECT
CASE WHEN SelectedWinners = RealLifeWinners THEN (TotalTally * PointValue) ELSE '0' END
AS [NewPoints]
FROM NCAATable
) AS [Tourney]
SET TotalTally = ReassignedPoints
Can someone help me to write a sproc that executes such an UPDATE operation all at once?
I'm trying to run an UPDATE sproc en masse to tally the results of a voting app I built for the upcoming NCAA March Madness tournament. I'm trying to update a master table with the value of a computed column.
If two fields match (SELECTEDWINNERS and REALLIFEWINNERS), then the value of an INT field, TOTALTALLY, is multiplied by the value of POINTVALUE.
I tried this, to no avail:
UPDATE (
SELECT
CASE WHEN SelectedWinners = RealLifeWinners THEN (TotalTally * PointValue) ELSE '0' END
AS [NewPoints]
FROM NCAATable
) AS [Tourney]
SET TotalTally = ReassignedPoints
Can someone help me to write a sproc that executes such an UPDATE operation all at once?