We consider associative algebras $\Lambda$ over a field provided with a direct sum decomposition of a two-sided ideal $M$ and a sub-algebra $A$ – examples are provided by trivial extensions or triangular type matrix algebras. In this relative and split setting we describe a long exact sequence computing the Hochschild cohomology of $\Lambda$. We study the connecting homomorphism using the cup-product and we infer several results, in particular the first Hochschild cohomology group of a trivial extension never vanishes.