Quickly generate ascii text sql scripts based off of sql 2008 database

≡放荡痞女 提交于 2019-12-11 01:29:52

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/2113858/quickly-generate-ascii-text-sql-scripts-based-off-of-sql-2008-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!