What I like to do is 1st write a view that will give me a visual display of the information that will be written.
I am using SQL 2005 and I do a GUI view which gives me the SQL statement for that view. I hate to write JOINS manually! I then take that SQL statement create a stored procedure and add the insert into command at the top.
If you aren't using SQL 2005 you can also try to link an Access database to your SQL database and do a query in Access to create what you need to do and get the SQL view to copy over. A little more work for this because you will need to do some code conversion once you get the SQL code from Access.
I am using SQL 2005 and I do a GUI view which gives me the SQL statement for that view. I hate to write JOINS manually! I then take that SQL statement create a stored procedure and add the insert into command at the top.
If you aren't using SQL 2005 you can also try to link an Access database to your SQL database and do a query in Access to create what you need to do and get the SQL view to copy over. A little more work for this because you will need to do some code conversion once you get the SQL code from Access.