In this post we will see how can we resolve a very common error while working with SQL Server Data Tools in Visual Studio. The error statement is – “Error SQL70001: This statement is not recognized in this context“. This error occurs in Visual Studio whenever we try to execute some SQL statements which are not DDL in nature. For ex – INSERT, UPDATE statements present in a SQL Script might throw this kind of error.
There is a very simple trick to resolve this issue. Let’s see what need to be done.
- Select the SQL script that is throwing this error.
- Go to Properties window and change the “Build Action” property for the script from “Build” to “None“.
- You’re done. Recompile the project without any errors.
Hope you like this small tip. Keep learning and sharing! Cheers!