Integral $\int\sqrt{1-\cos2x}~dx=$?
Yes, you can simplify as you did at the end, but no need for integration by parts! Recall, $\sqrt 2$ is merely a constant!
$$\int \sqrt 2 \sin x \,dx = \sqrt 2 \int \sin x \,dx = -\sqrt 2 \cos x + C$$
You did the "hardest part" by recognizing the trigonometric identity here. The rest is simply knowing that $\int \sin x = -\cos x + C$
$\newcommand{\+}{^{\dagger}}% \newcommand{\angles}[1]{\left\langle #1 \right\rangle}% \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}% \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}% \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}% \newcommand{\dd}{{\rm d}}% \newcommand{\ds}[1]{\displaystyle{#1}}% \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}% \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}% \newcommand{\fermi}{\,{\rm f}}% \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}% \newcommand{\half}{{1 \over 2}}% \newcommand{\ic}{{\rm i}}% \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow}% \newcommand{\isdiv}{\,\left.\right\vert\,}% \newcommand{\ket}[1]{\left\vert #1\right\rangle}% \newcommand{\ol}[1]{\overline{#1}}% \newcommand{\pars}[1]{\left( #1 \right)}% \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}}% \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}% \newcommand{\sech}{\,{\rm sech}}% \newcommand{\sgn}{\,{\rm sgn}}% \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}}% \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ Integrate $\verts{\sin\pars{x}}$, for example, as follows.
With $x > 0$: \begin{align} &\int_{0}^{x}\verts{\sin\pars{t}}\,\dd t = x\verts{\sin\pars{x}} - \int_{0}^{x}t\ \sgn\pars{\sin\pars{t}}\cos\pars{t}\,\dd t \\[3mm]&= x\verts{\sin\pars{x}} - \int_{0}^{x}\sgn\pars{\sin\pars{t}}\phi'\pars{t}\,\dd t \quad\mbox{where}\quad\phi\pars{x} \equiv \int_{0}^{x}t\cos\pars{t}\,\dd t \\[3mm] &\int_{0}^{x}\verts{\sin\pars{t}}\,\dd t = x\verts{\sin\pars{x}} - \sgn\pars{\sin\pars{x}}\phi\pars{x} + \int_{0}^{x}\phi\pars{t}\bracks{2\delta\pars{\sin\pars{t}}\cos\pars{t}}\,\dd t \\[3mm]&= x\verts{\sin\pars{x}} - \sgn\pars{\sin\pars{x}}\phi\pars{x} + 2\int_{0}^{x}\phi\pars{t}\sum_{n = 0}^{n\pi \leq x}\delta\pars{t - n\pi}\cos\pars{t}\,\dd t \\[3mm]&= x\verts{\sin\pars{x}} - \sgn\pars{\sin\pars{x}}\phi\pars{x} + 2\sum_{n = 0}^{n\pi \leq x}\pars{-1}^{n}\phi\pars{n\pi} \end{align} Also \begin{align} \phi\pars{x}&=x\sin\pars{x} - \int_{0}^{x}\sin\pars{t}\,\dd t = x\sin\pars{x} + \cos\pars{x} - 1 \end{align} \begin{align} \int_{0}^{x}\verts{\sin\pars{t}}\,\dd t = \sgn\pars{\sin\pars{x}}\bracks{1 - \cos\pars{x}} + 2\sum_{n = 0}^{n\pi \leq x}\pars{-1}^{n}\bracks{\cos\pars{n\pi} - 1} \end{align} $$\color{#0000ff}{\large% \int_{0}^{x}\verts{\sin\pars{t}}\,\dd t = \sgn\pars{\sin\pars{x}}\bracks{1 - \cos\pars{x}} + 4\sum_{n = 0}^{\pars{2n + 1}\pi \leq x}1} $$