发布到SQL Azure失败,并显示“无法删除外部数据源"消息 [英] Publish to SQL Azure fails with 'Cannot drop the external data source' message

查看:141
本文介绍了发布到SQL Azure失败,并显示“无法删除外部数据源"消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的解决方案中有一个SQL项目(.sqlproj),目标平台为"Microsoft Azure SQL数据库V12".

I've got an SQL Project (.sqlproj) in my solution with target platform 'Microsoft Azure SQL Database V12'.

最近我添加了一个external data source和几个external tables来定位此数据源.

Recently I've added an external data source and several external tables targeting this data source.

ExternalCSVLists.sql 文件:

CREATE EXTERNAL DATA SOURCE [ExternalCSVLists] WITH
(  
    TYPE = RDBMS,
    LOCATION = 'location.windows.net',
    DATABASE_NAME = '$(CSVLists)',
    CREDENTIAL = RemoteConnectionCredential
)

外部表示例( IntegerListContent.sql 文件)

CREATE EXTERNAL TABLE [WebApp].[IntegerListContent] 
(  
     [ListId] INT,
     [Value] int 
)
WITH  
(  
    DATA_SOURCE = [ExternalCSVLists]
) 

第一次发布就可以了.

现在,当我再次发布(对外部表或数据源未做任何任何更改)时,我收到以下错误消息:

Now, when I publish again ( not having any changes done to either of external tables or data-sources), I receive the following error:

删除[ExternalCSVLists] ... (415,1):SQL72014:.Net SqlClient数据提供程序:消息33165,级别16,状态1,行1无法删除外部数据源'ExternalCSVLists',因为它由外部表使用.

Dropping [ExternalCSVLists]... (415,1): SQL72014: .Net SqlClient Data Provider: Msg 33165, Level 16, State 1, Line 1 Cannot drop the external data source 'ExternalCSVLists' because it is used by an external table.

我已经检查了发布脚本,并注意到它试图删除并创建外部数据源.外部表被跳过(这可能是可以的,因为我没有更改它们).

I've inspected the publish script and noticed that it attempt to drop-and-create the external data source. The external tables are skipped ( which is probably OK since I didn't change them ).

所以

1)为什么所有此类数据源都与已经发布的数据源相同时为什么会产生drop external data source语句

1) why does it yield a drop external data source statement when all such data sources are identical to those already published

2)为什么为什么忽略从属的external tables?

2) why does it ignore the dependent external tables then?

我的发布设置几乎是默认设置(删除"标签中的所有选项均未选中).谢谢!

My publish settings are pretty much default (none of the options in 'Drop' tab are checked ). Thanks!

推荐答案

我遇到了同样的问题;不幸的是,我无法弄清楚为什么会首先产生此问题.

I hit the same issue; and unfortunately I could not figure out why this problem was created in the first place.

但是解决方法是引入一个部署前步骤,以删除所有

But the work around was to introduce a pre-deployment step that dropped ALL

  • 表格和
  • 观看次数

它引用了外部数据源...我希望DACPAC能够独立执行此操作;但我想我们生活在一个不完美的世界中.

That referenced the External Data Source... I would have expected the DACPAC to perform this on its own; but I suppose we live in a non-perfect world.

这篇关于发布到SQL Azure失败,并显示“无法删除外部数据源"消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆