Hi So, I have the SP below which updates the Exec_Code, based on the Policy Type. I'm wondering should I split this into four different procedures instead? So that I could have SP 1 as
SET Exec_Code = PC_MAP WHERE (PolType = PC) AND (PC_Map <> '0000')
Or should I get the same performance from using the Case statement as below?
CREATE PROCEDURE dbo.PersLines_ByDir AS SET NOCOUNT ON UPDATE dbo.Monthly_Pre SET Exec_Code = CASE PolType WHEN 'PC' THEN CASE WHEN PC_Map = '0000' THEN Exec_Code ELSE PC_Map END WHEN 'HC' THEN CASE WHEN HC_Map = '0000' THEN Exec_Code ELSE HC_Map END WHEN 'HQ' THEN CASE WHEN HC_Map= '0000' THEN Exec_Code ELSE HC_Map END WHEN 'HI' THEN CASE WHEN HI_Map= '0000' THEN Exec_Code ELSE HI_Map END END FROM blahblah WHERE PolType In ('PC','HC','HQ','HI');