Apologies if this has been answered already but I have yet been unable to find an answer :(
I'm using SQL Server Management Studio 2008 on Windows 7 box.
I right-click any sproc, function or object and choose "Modify".
I click "Save" and save the file to a folder that is a git repository on my local hard drive.
I save the file as suggested type = "Microsoft SQL Server Query File (.sql)
So now I have a file e.g. "MySproc.sql" which opens fine in SQL Management studio, however when I use Git GUI and do a "scan" to find modified files it presents my new "MySProc.sql" as "* Binary file (not showing content)." instead of simple text.
I've tried opening the file in NOtepad and re-saving it but that did not fix it.
Any help would be greatly appreciated.
"Why is Git marking my file as binary?" The answer is because it's seeing a NUL (0) byte somewhere within the first 8000 characters of the file.
Getting started with Git GUI In order for this new repository to be initialized, you must first create a file, any file, in your local repo. Then, you must Commit and Push to the remote Git repository location. In order to clone a repository, click on the “Clone Existing Repository” link in the Git GUI window.
sql file is a binary file.
Start “Git Commit Tool” with a right click, stage the file by clicking on the icon next to the filename, add a message and the click commit. Open Git history from the Git Gui, choose the “Repository” menu, “Visualize master's history”. Notice that you have two commits now, and the second one has your name on it.
Just a guess, but I would say your .sql file is UTF-16; If you were to save it as UTF-8 or ASCII, I imagine git gui would work properly with it.
It is annoying, but what I do is change the extension to .txt before uploading changes. I think the .sql extension is what is tripping up git.
P.S. Here's a valuable tip if you are using SQL Server Management Studio. Right click on your database. Choose Tasks from the popup menu and then Generate Scripts. That brings you into a wizard where you can generate scripts for everything in your database. You can output all scripts into a single folder. Then use a program like oscar's renamer to change the extension to .txt before you commit your changes. It is a great way to add source control (albeit manual) to your database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With