The syntax for inline index declaration was added in SQL Server 2014, though that isis was absolutely unclear in the official CREATE TABLE
documentation. After speaking to the documentation owners, that topic now accurately reflects that inline index syntax is only valid starting with SQL Server 2014 (and some variations in 2016):
The other serversinstances, where this syntax is working for you, must be >=on SQL Server 2014 (any compatibility level)or newer.
On 2012, regardless of compatibility level, you'll need to create the index separately.