The SQL 2005 books online conain a lot of information for beginners. The sections on create procedure, insert statements, update statements and if - else statements will probably be of most use for this problem
If you are stuck, we'll be happy to give advice and assistance
So what, specifically, do you need help with?
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass