% arara: pdflatex
\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{datatool}

\newcommand*{\switchargs}[2]{#2#1}
\DTLloaddb{scores2}{scores2.csv}

\begin{document}
\begin{table}[htbp]
\caption{Student Scores (sorting ignores \texttt{\textbackslash switchargs})}\centering
\DTLsort*{Surname,FirstName}{scores2}%
\begin{tabular}{llr}
\bfseries Surname &
\bfseries First Name &
\bfseries Score (\%)%
\DTLforeach*{scores2}{%
\firstname=FirstName,\surname=Surname,\score=Score}{%
\\
\surname & \firstname & \score}
\end{tabular}
\end{table}


\end{document}
