# End column separator with sidewaystable aligned strangely

I've been having trouble getting a text-width sideways table to look right. In the example below the end column separator is strangely detached from the end of the table as can be seen below.

How can I get rid of this gap? The code is as follows:

\documentclass{article}

\usepackage{rotating}
\usepackage{tabularx}
\usepackage{lipsum}

\begin{document}

\begin{sidewaystable}
\caption{This is my table}
\centering
\begin{tabularx}{\textwidth}{|p{0.15\textwidth}|p{0.4\textwidth}|p{0.2\textwidth}|p{0.2\textwidth}|}
\hline
\textbf{Column 1} & \textbf{Column 2} & \textbf{Column 3} & \textbf{Column 4}\\
\hline
Row 1 & \lipsum[2] & some text & more text in here \\
\hline
Row 2 & \lipsum[3] & some text & more text in here \\
\hline
\end{tabularx}
\end{sidewaystable}

\end{document}


A tabularx environment is useless if it has not at least one X column. Here your table is wider than \textheight (due to 8 \tabcolseps). Here is a correct version of the code:

\documentclass{article}

\usepackage{rotating}
\usepackage{tabularx}
\usepackage{lipsum}

\begin{document}

\begin{sidewaystable}
\caption{This is my table}
\setlength{\extrarowheight}{2pt}
\centering
\begin{tabularx}{\textwidth}{|>{\hsize=0.64\hsize}X|>{\hsize=1.68\hsize}X|*{2}{>{\hsize=0.84\hsize}X|}}
\hline
\textbf{Column 1} & \textbf{Column 2} & \textbf{Column 3} & \textbf{Column 4}\\
\hline
Row 1 & \lipsum[2] & some text & more text in here \\
\hline
Row 2 & \lipsum[3] & some text & more text in here \\
\hline
\end{tabularx}
\end{sidewaystable}

\end{document}
`