SSDT – Error SQL70001 This statement is not recognized in this context-摘自网络
March 28, 2013 — arcanecode
One of the most common errors I get asked about when using SQL Server Data Tools (SSDT) Database Projects is the error “This statement is not recognized in this context”. This is actually a pretty simple error to fix.
Envision this scenario. You have a simple table:
CREATE TABLE [dbo].[Test] ( [Id] INT IDENTITY NOT NULL PRIMARY KEY , [SomeData] NVARCHAR(20) NOT NULL )
Great. So then you want to have a post deployment script which will populate it with some default value. Because we are following best practices we creating a post deployment script which then calls the script to populate the default data.
:r .\InsertSomeData.sql
Then we have the script InsertSomeData.sql itself:
INSERT INTO [dbo].[Test] ([SomeData]) VALUES (‘Arcane Code’)
After inserting the code, or doing a build, you get this ugly error pop up in the error window:
So what happened? Well, when you went to insert the script you had these options in the dialog:
If you aren’t careful, you could accidentally pick the “Script (Build)” option (highlighted in blue). This option attempts to compile and run the code as DDL (Data Definition Language, the T-SQL syntax which creates tables, indexes, etc.) syntax. Things like Insert statements though are considered DML (Data Manipulation Language) code, and aren’t eligible to be compiled as part of the project. This is what generates the “This statement is not recognized in this context” error. You are essentially putting DML code where only DDL is allowed.
But don’t despair, this is extremely simple to fix. In SSDT, simply bring up the Properties dialog for the SQL script (click in the SQL script, then View, Properties in the menu). Pick the Build Action property, and change it to None.
And that’s it, the error “SQL70001 This statement is not recognized in this context” should now vanish from your error list.
SSDT – Error SQL70001 This statement is not recognized in this context-摘自网络的更多相关文章
- SQL70001: This statement is not recognized in this context.
关于错误: SQL70001: This statement is not recognized in this context. 的产生原因以及解决办法. 在SQL Server Databas ...
- HiveServer2 的jdbc方式创建udf的修改(add jar 最好不要使用),否则会造成异常: java.sql.SQLException: Error while processing statement: null
自从Hive0.13.0开始,使用HiveServer2 的jdbc方式创建udf的临时函数的方法由: ADD JAR ${HiveUDFJarPath} create TEMPORARY funct ...
- iReport 5.6.0 Error: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : data 最优解决方案
问题描述 近期学习iReport(个人使用的是最新版本的 iReport-5.6.0,MySQL是 5.5.56版本),遇到一些问题,在安装完成后,创建了数据库,配置了MySQL数据库连接信息,新建报 ...
- Hplsql报错:...HiveSQLExpection:Error while compiling statement:No privilege 'Select' found for inputs {.....}
实践hplsql时,遇到的问题总结一下,若有不对的地方,欢迎交流. 一.Hplsql简介 hplsql的介绍详见:http://lxw1234.com/archives/2015/09/492.htm ...
- 解决hiveserver2报错:java.io.IOException: Job status not available - Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
用户使用的sql: select count( distinct patient_id ) from argus.table_aa000612_641cd8ce_ceff_4ea0_9b27_0a3a ...
- Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in
学习php的命名空间,直接把手册的代码粘贴过来,却报错了:Fatal error: Namespace declaration statement has to be the very first s ...
- java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
执行Hive查询: Console是这样报错的 java.sql.SQLException: Error from org.apache.hadoop.hive.ql.exec.mr.MapRedTa ...
- HiveSQLException: Error while compiling statement: No privilege 'Create' found for outputs { database:default }
今天用Hive的JDBC实例时出现了HiveSQLException: Error while compiling statement: No privilege 'Create' found for ...
- Hive 报错 Error while compiling statement: FAILED: ParseException line 1:0 character '' not supported here (state=42000,code=40000)
Hive报错 Error while compiling statement: FAILED: ParseException line 1:0 character '' not supported h ...
随机推荐
- log4j配置文件写法
### direct log messages to stdout ###log4j.rootLogger=DEBUG,stdoutlog4j.appender.stdout=org.apache.l ...
- 4、Hbase
1).逻辑模型 Hbase 以表的形式存储数据,每个表由行和列组成,每个列属于一个特定的列族. 表中由行和列确定的存储单元称为一个元素,每个元素保存了同一份数据的多个版本,由时间戳来标识.行健是数据行 ...
- 网络请求 post 的接受请求头的代理方法
接收响应头 content-Length content-Type - (void)connection:(NSURLConnection *)connection didReceiveRespons ...
- Python从list删除元素
Paul同学刚来几天又要转走了,那么我们怎么把Paul 从现有的list中删除呢? 如果Paul同学排在最后一个,我们可以用list的pop()方法删除: >>> L = ['Ada ...
- python 删除文件和文件夹
1.删除文件 '''删除文件 ''' def DeleteFile(strFileName): fileName = unicode(strFileName, "utf8") if ...
- 静态页面参数传递&回调函数写法&快速排序的实现方法
相信很多人都有一种陋习,就是收藏的文章,几乎从来都没有回过头来仔细看过.这次借着这次活动的机会,在<无懈可击的web设计>一书的学习过程中,穿插着讲自己曾经收藏过的,现在觉得还有价值的文章 ...
- python机器学习库
http://scikit-learn.org/stable/install.html
- What's this?(js)
What's this? 由于运行期绑定的特性,JavaScript 中的 this 含义非常多,它可以是全局对象.当前对象或者任意对象,这完全取决于函数的调用方式 随着函数使用场合的不同,this的 ...
- Java集合类之LinkedList链表
package com.test; import java.util.*; public class Demo7_3 { public static void main(String[] args) ...
- 插入排序InsertionSort
/** * * @author Administrator * 功能:插入排序法 */ package com.test1; import java.util.Calendar; public cla ...