damixa
asked on
Fix in a Sql Statement for Sql Server 2008
I have some code. What I am trying to do is update a certain field to the max + 1
this is the code that I have
the error I get is An aggregate may not appear in the set list of an UPDATE statement.
Thanks in advance
this is the code that I have
update tblBNKrecon
set groupedpmtid = (MAX(GroupedPmtID)+1), newdesc = 'FEHBP'
where groupedpmtid = 811209465 and [desc] = 'FEHBP HCCLAIMPMT'
the error I get is An aggregate may not appear in the set list of an UPDATE statement.
Thanks in advance
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys,
Im also getting a warning
Warning: Null value is eliminated by an aggregate or other SET operation.
everything seems to be working though. Can you tell me what this means?
Im also getting a warning
Warning: Null value is eliminated by an aggregate or other SET operation.
everything seems to be working though. Can you tell me what this means?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a ton
set groupedpmtid = (select MAX(GroupedPmtID) + 1 from tblBNKrecon), newdesc = 'FEHBP'
where groupedpmtid = 811209465 and [desc] = 'FEHBP HCCLAIMPMT'