It is my day for weird errors.
这是我奇怪的错误的一天。
I use a database project and as a part of Post Deployment, we use SQL Scripts to populate data in our tables.
我使用一个数据库项目,作为Post部署的一部分,我们使用SQL脚本在表中填充数据。
alter authorization on database::atlas to sa;
go
ALTER DATABASE ATLAS SET MULTI_USER WITH ROLLBACK IMMEDIATE;
GO
:r C:\Scripts\Script.DisableTriggers.sql
:r C:\Scripts\dbo\Script.dbo.PaymentMethod.sql
:r C:\Scripts\dbo\Script.dbo.TransactionEntryMethod.sql
:r C:\Scripts\dbo\Script.dbo.TransactionTypeGroup.sql
:r C:\Scripts\dbo\Script.dbo.TransactionType.sql
:r C:\Scripts\Script.EnableTriggers.sql
each of these scripts is very similar to the one below
每个脚本都与下面的脚本非常相似
SET IDENTITY_INSERT [dbo].[TransactionTypeGroup] ON
INSERT INTO [dbo].[TransactionTypeGroup] (TransactionTypeGroupID,TransactionTypeGroupName) VALUES
(1,'Inquiry')
, (2,'Points')
, (3,'Board')
, (4,'Guest Meals')
, (5,'Cash Equivalency')
, (6,'Deposits')
, (7,'Void/Void Tender')
, (8,'Refund')
SET IDENTITY_INSERT [dbo].[TransactionTypeGroup] OFF
GO
When I get my output back, I get the following error:
当我得到输出时,我得到以下错误:
(1 row(s) affected)
(1 row(s) affected)
(25 row(s) affected)
(11 row(s) affected)
(2 row(s) affected)
(598 row(s) affected)
(3 row(s) affected)
Msg 102, Level 15, State 1, Line 234
Incorrect syntax near 'OFFSET'.
I have searched my entire SQL directory, and there is no word called OFFSET in any SQL file or in any command that I am issuing. But yet I get that error..
我搜索了我的整个SQL目录,在任何SQL文件或我正在发布的任何命令中都没有名为OFFSET的词。但我还是犯了这个错误。
Msg 102, Level 15, State 1, Line 234
Incorrect syntax near 'OFFSET'.
Msg 102,第15级,状态1,第234行错误语法接近“偏移”。
What is going on here?
这是怎么回事?
2 个解决方案
#1
3
This is baadddddddd
这是baadddddddd
It will concatenate commands together from file to file
它将把命令从一个文件连接到另一个文件
One file ended this way
一个文件以这种方式结束
SET IDENTITY_INSERT TABLEONE OFF
Next file started this way
下一个文件是这样开始的。
SET IDENTITY_INSERT TABLETWO ON
But the first file did not have a blank line after the SET IDENTITYINSERT OFF.
但是第一个文件在SET IDENTITYINSERT OFF之后没有空行。
SSMS was putting the two files together and executing them, so the output became
SSMS将两个文件放在一起并执行它们,因此输出变成了
SET IDENTITY_INSERT TABLEONE OFFSET IDENTITY_INSERT TABLETWO ON
and that's how this error came up
这就是错误出现的原因
Msg 102, Level 15, State 1, Line 234
Incorrect syntax near 'OFFSET'.
Horrendous.
可怕的。
I just submitted a bug into Microsoft Connect.
我刚刚向微软连接提交了一个错误。
#2
1
Did you check if a trigger is firing in Script.EnableTriggers.sql? If you don't know your trigger code, try this:
您是否检查了在Script.EnableTriggers.sql中是否触发的触发器?如果你不知道你的触发码,试试这个:
select * from sys.sql_modules where definition like '%OFFSET%'
Let me know if you find anything.
如果你找到什么就告诉我。
Thanks, Eric
谢谢你,埃里克
#1
3
This is baadddddddd
这是baadddddddd
It will concatenate commands together from file to file
它将把命令从一个文件连接到另一个文件
One file ended this way
一个文件以这种方式结束
SET IDENTITY_INSERT TABLEONE OFF
Next file started this way
下一个文件是这样开始的。
SET IDENTITY_INSERT TABLETWO ON
But the first file did not have a blank line after the SET IDENTITYINSERT OFF.
但是第一个文件在SET IDENTITYINSERT OFF之后没有空行。
SSMS was putting the two files together and executing them, so the output became
SSMS将两个文件放在一起并执行它们,因此输出变成了
SET IDENTITY_INSERT TABLEONE OFFSET IDENTITY_INSERT TABLETWO ON
and that's how this error came up
这就是错误出现的原因
Msg 102, Level 15, State 1, Line 234
Incorrect syntax near 'OFFSET'.
Horrendous.
可怕的。
I just submitted a bug into Microsoft Connect.
我刚刚向微软连接提交了一个错误。
#2
1
Did you check if a trigger is firing in Script.EnableTriggers.sql? If you don't know your trigger code, try this:
您是否检查了在Script.EnableTriggers.sql中是否触发的触发器?如果你不知道你的触发码,试试这个:
select * from sys.sql_modules where definition like '%OFFSET%'
Let me know if you find anything.
如果你找到什么就告诉我。
Thanks, Eric
谢谢你,埃里克