Advertisement
| 10.06.2008 at 10:18AM PDT, ID: 23791147 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: |
CREATE PROCEDURE dbo.UpdateuserID AS -- Need to first update contact to inactivate MAX id value UPDATE t1 SET t1.status = 'i' , t1.modified_on = GETDATE() FROM CONTACT t1 INNER JOIN ( SELECT name , MIN(id) AS id FROM CONTACT WHERE status = 'a' GROUP BY name HAVING COUNT(*) > 1 ) t2 ON t1.name = t2.name AND t1.id <> t2.id WHERE t1.status = 'a' /* IF ((SELECT wi2.customer_id FROM workitem wi2 WHERE wi2.number=wi.number) = (SELECT wi3.contact_id FROM workitem wi3 WHERE wi3.number=wi.number)) BEGIN */ UPDATE wi SET wi.contact_id = c2.id, wi.customer_id=c2.id From workitem wi inner join ( Select id, name from contact where status = 'i' group by name, id )c on c.id = wi.contact_id Inner join ( select name, id from contact where status = 'a' group by name, id )c2 on c.name = c2.name where c.id<>c2.id /* END ELSE BEGIN*/ --Then update the workitem tables with the active id value UPDATE wi SET wi.contact_id = c2.id From workitem wi inner join ( Select id, name from contact where status = 'i' group by name, id )c on c.id = wi.contact_id Inner join ( select name, id from contact where status = 'a' group by name, id )c2 on c.name = c2.name where c.id<>c2.id --END -- Then delete the inactive id value from the contact table delete from contact where status = 'i' GO |
Advertisement