基于sql 2008数据库快速生成ascii文本sql脚本
这开始让我感到沮丧,主要是因为它应该很容易做到,但我找不到任何东西。
我正在尝试对我的数据库进行版本控制。我决定的方法是在每次签入时生成脚本,为数据库中的每个对象创建一个 sql 脚本。我的大部分编辑都是通过 SSMS 中的可视化设计器完成的,我不相信自己每次都能记住生成更改脚本。我现在只关心模式,尽管很快我就想要来自某些查找表的数据。
我尝试了以下操作,但没有取得多大成功:
我尝试通过 SSMS 任务 -> 生成脚本来生成脚本。我不喜欢这个有两个原因。
它似乎没有保存你给它的设置,所以每次我想生成脚本时我都必须将设置更改为我想要的,更改输出路径等等。我真的只是想按一两个按钮即可快速完成预提交过程。
它似乎使用 USC 格式生成脚本,这意味着版本控制 (git) 将其视为二进制文件,因此无法在版本之间进行比较(这是我想要存储的重要原因之一)版本控制中的数据库)。
我还尝试使用dbSourceTools。该工具修复了 SMSS 的问题 #1,并且使更新架构定义变得非常容易,但它生成的 .sql 文件也使用 USC 格式的文本,这意味着版本控制将其视为二进制文件。
我正在寻找一种免费的方法来做到这一点,因为我现在正在从事一个业余爱好项目。
This is starting to frustrate me, mostly because it should be easy to do but I can't find anything.
I am trying to version control my database. The method I have decided upon is to generate scripts at each check-in that creates a sql script for every object in my database. Most of my edits are done via the visual designer in SSMS and I don't trust myself to remember to generate change scripts every time. I am only concerned with the schema for now, although soon I would like data from certain lookup tables.
I have tried the following with not much success:
I attempted to generate scripts via SSMS Tasks->Generate Scripts. I don't like this for two reasons.
It does not seem to save what settings you give it, so every time I want to generate scripts I have to change the settings to what I want, change the output path, etc.. I really just want to press a button or two and be a quick pre-commit process.
it seems to generate scripts using USC formatting, which means version control (git) sees it as being a binary file and thus can't do comparisons between versions (which is one of the big reasons I want to store the DB in version control).
I also attempted to use dbSourceTools. This tool fixed issue #1 from SMSS and made it real easy to update the schema definitions, yet the .sql files it generated used USC formatted text as well, which meant version control saw it as a binary file.
I am looking for a free method to do this as I am working on a hobby project right now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用的是 Visual Studio Developer Edition 或 Visual Studio Team Suite,则可以免费使用 Visual Studio Database Professional。这是管理数据库模式的绝佳工具。
If you are using Visual Studio Developer Edition or Visual Studio Team Suite, you can use Visual Studio Database Professional for free. This is a fantastic tool for managing your database schema.