This is a good way to do it in SQL 2005, but don't forget the optional 3rd section for deleting data. ...
stackoverflow.com