Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to change file type from binary to text for .sql file

cgammans
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 19, 2012

hello,

I've added a sql file via TortoiseHg to my Mercurial repository and it went in a a binary file rather than text.

1) Can I change it to text so that I can see revision changes through the web interface like all my other source files?

2) Was there something I missed when adding which caused this?

Thank you.

3 answers

1 accepted

4 votes
Answer accepted
cgammans
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 27, 2013

The problem turns out to be that the file was created in unicode rather than ansi text encoding by SQL Server Management Studio. It was a default option on the export task.

Mercurial does not play nicely with it and adds it to the repository as a binary file which will not allow previewing or diffs from TortoiseHg or the web interface.

So, to answer my original question of how to change it after it has been added, I opened it in notepad and saved it as an ANSI file. Now it works.

0 votes
Sam Hard
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 25, 2016

In case someone who runs across this has a lot of these files, like I did, you could run this PowerShell script to update all of your .SQL files at once.

Get-ChildItem -Recurse *.sql | foreach {
$FileName = $_.FullName;
[System.Io.File]::ReadAllText($FileName) | Out-File -FilePath $FileName -Encoding UTF8;
}
0 votes
AgentSmith
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 22, 2013

Greetings!

SQL files, like images (.jpg, etc) are generally transferred over SSH, FTP and SCP in binary (BIN) format.

The standard approach would be to load the SQL file into a local DB such as MySQL and from there you can select data as well as export data.

If you really want to convert the data to text format, most likely your best bet is to research/find/download a 3rd party application or you might get lucky by using wordpad or other word editors.

For 3rd party solutions, I just did a google search and found several hits, for example: http://convert.software.informer.com/download-convert-sql-file-to-text-file/

I hope this response was helpful.

Cheers,
Jason | Atlassian

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events