locked
i want to update a sql statement if it is only not NULL RRS feed

  • Question

  •  

    update tbl_Case set case_prim_aty = case_prim_aty + ',' + @strNewAtyId, case_aty_name_for_forms = case_aty_name_for_forms + '/' + @strAtyFormName, case_aty_lic_number = case_aty_lic_number + '/' + @strAtyLicNum, case_aty_court=case_aty_court +'/'+ @strAtyCourt,case_aty_state = case_aty_state + '/' + @strAtyState, case_aty_volage_number = case_aty_volage_number + @strAtyVolageNum, case_updated_by = @strUserId, case_update_ts = getdate() where org_id = @strOrgId and case_prim_aty like '%' + @strOldAtyId + '%' and case_id = @strCaseId and @strDestAtySignForms ='Y' and cs_odc = @strodc

    i want above to be executed only if @strodc is not null else

    update tbl_Case set case_prim_aty = case_prim_aty + ',' + @strNewAtyId, case_aty_name_for_forms = case_aty_name_for_forms + '/' + @strAtyFormName, case_aty_lic_number = case_aty_lic_number + '/' + @strAtyLicNum, case_aty_court=case_aty_court +'/'+ @strAtyCourt,case_aty_state = case_aty_state + '/' + @strAtyState, case_aty_volage_number = case_aty_volage_number + @strAtyVolageNum, case_updated_by = @strUserId, case_update_ts = getdate() where org_id = @strOrgId and case_prim_aty like '%' + @strOldAtyId + '%' and case_id = @strCaseId and @strDestAtySignForms ='Y'

    this has to be executed ..

    Well i  m not interested in same statements twice!!.. Please let me know if any1 s having better solution.

    Wednesday, March 16, 2011 10:51 AM