ScrewBalll
Programmer
Hi there, I'm in need of some help regarding updating an sql table from a staging table. I have a master table with approximately 25 populated fields, now this table is being sent updates which are placed into a staging table. The problem I have is that to save resources only ammended details are placed into the staging table with the key fields.
For example:
KEY; FIELD1; FIELD2; FIELD3; FIELD4
DATA DATA DATA DATA DATA (MASTER TABLE)
DATA NULL NULL NULL DATA (Staging table)
In this example I only want to ammend Field4. If i carry out a complete update fields 1-3 are updated to null which isn't right. I will not know what fields have been ammended beforehand so the only way I can think to carry this out is to use lots of 'IF NOT ISNULL' statements. But with the amount of data I'm being passed this takes up to many resources. I'm hoping for a more efficient method if possible.
Please help.
For example:
KEY; FIELD1; FIELD2; FIELD3; FIELD4
DATA DATA DATA DATA DATA (MASTER TABLE)
DATA NULL NULL NULL DATA (Staging table)
In this example I only want to ammend Field4. If i carry out a complete update fields 1-3 are updated to null which isn't right. I will not know what fields have been ammended beforehand so the only way I can think to carry this out is to use lots of 'IF NOT ISNULL' statements. But with the amount of data I'm being passed this takes up to many resources. I'm hoping for a more efficient method if possible.
Please help.