在 Visual Studio 数据库项目/SQL Server 中创建默认数据

发布于 11-06 09:26 字数 235 浏览 6 评论 0原文

有没有办法在VS 2010的数据库项目中使用数据生成计划来创建一组默认数据?或者我是否找错了树,即数据生成计划最适合创建虚拟示例数据?

我们有大量需要为每个数据库部署创建的数据(默认设置、默认用户等)。如果有工具来帮助我们解决这个问题就好了,这样我们就可以对其进行源代码控制并更好地进行管理。

我猜测可能有第三方替代品,但我希望有一个内置的 Visual-Studio-Way 来做事,这样它就可以与 TFS 等很好地集成。

Are there way to using data generation plans in VS 2010's database projects to create a set of default data? Or am I barking up the wrong tree i.e. are data generation plans best suited to create dummy example data?

We have a bunch of data (default settings, default users etc etc) that needs to be created for each database deployment. It would be nice to have tooling to help us with this, so it can be source controlled and better managed.

I'm guessing that there are probably third party alternatives, but I'm hoping there is a built-in Visual-Studio-Way of doing things, so it can integrate nicely with TFS etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亢潮2024-11-13 09:26:47

可能有不同的方法来执行此操作,但基本方法是:

  1. 创建一个插入默认数据的脚本
  2. 编辑 Script.PostDeployment.sql 脚本以使用您的脚本插入默认值

例如,我创建了一个新文件夹 DefaultData ,在我的项目的 Scripts->Post-Deployment 文件夹下,并添加了用于在此处插入默认数据的脚本 InsertDefaultData.sql。然后,我将以下行添加到 Script.PostDeployment.sql“:r ..\DefaultData\InsertDefaultData.sql”。

There are probably different ways to do this, but the basics are to:

  1. create a script that inserts your default data
  2. Edit the Script.PostDeployment.sql script to use your script for inserting the default values

For example, I created a new folder, DefaultData, under the Scripts->Post-Deployment folder of my project and added my script for inserting the default data here, InsertDefaultData.sql. Then, I added the following line to Script.PostDeployment.sql ":r ..\DefaultData\InsertDefaultData.sql".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文