To fix the following error:
Go into Microsoft SQL Server Management Studio and check that the compatibility mode for the database is set to SQL Server 2012. This can be done the following way:
Right Click on the database in question and click on properties:
Then go to Options and change compatibility level to SQL Server 2012 as shown below: