that's a perfect time to use a stored proc.
if you can't use a stored proc, it gets a little bit harder. Are you going to be adding and updating the same table? If not, then you can't do it with just one query, you'll need to issue at least two queries...
Although you may be able to combine the two queries that you form and separate them with a semicolon. Technically it should work, but don't be surprised if it doesn't.
hth leo
------------
Leo Mendoza
lmendoza@students.depaul.edu