0
Posted on Tuesday, September 13, 2016 by 醉·醉·鱼 and labeled under
项目是用SQLCMD加载文件进行schema部署的,如果部署中间出问题了,会是部分提交,还是全部回滚呢?

创建下面的文件

PRINT 'YES'
GO
update test
set someValue = 987
where id = 1
GO
THROW 51000, 'The record does not exist.', 1;  
GO
PRINT 'YES AGAIN'
GO

测试

sqlcmd -S .\MSSQLSERVER2012 -d event_service -i ./sqlcmd_test.sql -m-1 -r -I -b

结果是,部分提交,和你在SSMS里面一样,即使你加了-b option。
0
Responses to ... SQLCMD 不会回滚已经提交的改动

Post a Comment