Re: [SQL update question]
From: Max (maxl_at_msn.com)
Date: 12/13/04
- Next message: John Gilson: "Re: Relational question"
- Previous message: --CELKO--: "Re: Dynamically create column name within stored procedure"
- In reply to: Agnes: "[SQL update question]"
- Next in thread: David Portas: "RE: [SQL update question]"
- Messages sorted by: [ date ] [ thread ]
Date: 12 Dec 2004 21:10:25 -0800
1. a) select count(invno) from invchg where invno
= invinfo.invno group by invno' is returning the Null.
b) the following will remove the run-time error,
but are not the results you are seeking:
Update invinfo Set markseqno = IsNull((Select Count(invno)
>>From invchg
Join invinfo On invchg.invno = invinfo.invno
Group by invno), 0)
2. the only way your going to get a value inserted is
to insert it. Updates don't do Inserts unless you
have an Update Trigger that does them for you.
3. the following may solve the problem for you:
Update invinfo Set markseqno = IsNull((Select Count(invno)
>>From invchg
Join invinfo On invchg.invno = invinfo.invno
Group by invno), 0)
Insert invinfo (invchg.invno, markseqno)
Select invno, 0
>>From invchg
Left Join invinfo On invchg.invno = invinfo.invno
Where invinfo.invno Is Null
Group By invchg.invno
- Next message: John Gilson: "Re: Relational question"
- Previous message: --CELKO--: "Re: Dynamically create column name within stored procedure"
- In reply to: Agnes: "[SQL update question]"
- Next in thread: David Portas: "RE: [SQL update question]"
- Messages sorted by: [ date ] [ thread ]