Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Updating one database from table dump

Author  Topic 

jmj
Starting Member

7 Posts

Posted - 2002-07-17 : 08:50:28
Can someone tell me if I'm on the right path or how to handle this differently?
I'm doing a report card application.
Each quarter I do a dump of each individuals school's student info into a temp table. I then add new students and need to mark students who have left etc. In the dump table a child could possibly be listed several times- for example Johnny left schoolA and enrolled in schoolB. In schoolA's db he is now inactive/in schoolB he is active.
Depending on when Johnny changed schools will decide which school will be responsible for filling out the report card- there is a FlagField that is checked if the inactive school should fill out the report card. So what I need to do:
1. Update any inactive students who only appear one time in the temp table.
2. Look for duplicates in the temp table.
3. See if FlagField is yes- keep the student with previous school in database.
4. If FlagField is no- update the information with the new school information/teacher information.
Does this sound right? If so how would i do it in a stored proc? I guess I was thinking the stored proc would run basically as I set it up above-1st run an update query on all inactives who are only listed once in temp table- then look at the duplicates.
Thanks for any help.
j


   

- Advertisement -