• I'd tried the function within a database that had been restored into 2014 from a 2008 instance, so the compatibility level (100) of that database was set too low. When I tried the function in another database on the same 2014 server, a database that had been created within that 2014 instance, it worked.