Visual Studio数据库项目问题 [英] Visual Studio Database Project problem

查看:97
本文介绍了Visual Studio数据库项目问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



你好,

Hi there,

我是数据库项目的新手,我试图添加一个非空列现有表格。

I am new to Database Projects and I tried to add a not-null column to an existing table.

在Prescripts下的脚本中,我创建一个新的临时表并将数据复制到该表中。

In a script under Prescripts I create a new temporary Table and copy the data into that table.

我删除了alle FK指向该表格,之后我删除现有表格中的数据。

I remove alle the FK's pointing to that tablen and after that I delete the data in the existing table.

此方法显示在HOL文档中http://vsdatabaseguide.codeplex.com。

This approach is shown in a HOL document unter http://vsdatabaseguide.codeplex.com.

但这在Visual Studio 2010 Service Pack 1中不起作用。

But this does not work in Visual Studio 2010 Service Pack 1.

 

我发现的是部署引擎创建以下操作:

What I found out is that the deploy engine creates the following actions:

- 它检查表中是否有我添加列的数据。如果有则它会停止!!!!!

- It checks if there is data in the table where I added the column. If there is then it stops!!!!!

- 然后它会尝试删除我之前在我的处方中删除的所有外键约束。出现错误,部署中断!!!!

- Then it tries to drop all foreign key constraints which I dropped before in my prescript. There is an error and the deployment breaks!!!!

 

所以这不起作用。我不知道解决方案。
So this cannot work. I don't know a solution.

推荐答案

您好,

此处如果在预部署脚本中,目标表数据已被删除然后我很惊讶它在后面的步骤中失败了。在后面的步骤中,它检查目标数据库表中的任何记录的现有状态,因为它必须更改该表,如果该表中有数据,可能会产生
一些问题。因此关键在于,目标表中的数据可能无法成功删除。

Here if in Pre deployment script, target table data have been deleted then I am amazed how it got fail in the later steps. In the later step it is checking the existing of any records in the target database table as it has to alter that table and may create some problem if it has data in that table. So the key would be here that somehow the data in the target table might not have successfully deleted.

请参阅以下链接了解更多详情。

Please see the below links for more details.

http://social.msdn.microsoft.com /论坛/ zh-CN / vstsdb / thread / 05072dac-2228-4aa4-8e1d-938771048b95
$
http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/ab49536d-827d-49fd-a874- 6e29dd8104a7

谢谢,

 


这篇关于Visual Studio数据库项目问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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