插入到Tasks中
Select N'Anonymous',4,'SomeTable.targetcode in (select Code from cities where countrycode in ('TN')) and SomeTable.SomeValue in ('13','15')',3,N'Cities from tunis'
Union All
...字典是查询的一部分,我需要在我的服务器上运行。
我得到了:
Incorrect syntax near ')) and SomeTable.SomeValue in (13,15)'.如何修复这个错误??
发布于 2010-03-25 17:41:22
这是因为在一个值中有撇号。具体地说,您的过滤器字符串中包含撇号,需要通过将它们加倍来对其进行转义:
INSERT INTO [Tasks]
([LoginName]
,[Type]
,[Filter]
,[Dictionary]
,[Description])
Select N'Anonymous',4,'SomeTable.targetcode in (select Code from cities where countrycode in (''TN'')) and SomeTable.SomeValue in (''13'',''15'')',3,N'Cities from tunis'
Union All发布于 2010-03-25 17:42:34
从表面上看,您正在尝试将where子句的一部分插入到表中,这有点不清楚您到底要做什么。
让您着迷的是in ('TN'),因为该部分中的引号结束于外引号。试试(''TN'')
https://stackoverflow.com/questions/2514366
复制相似问题