In some situations I create scripts and store them in a folder. Later I will concatenate the contents using a batch file which doesn’t work very well if the files do not use the same encoding.If you have one in Codepage 1200 and another in Codepage 1252 then you will have some very odd characters in your resulting script
When writing a script in Sql Server Management Studio, you can save them with different encoding. I learnt the idea of a previous employee at work and found it useful.
By default Management Studio seems to want to save new scripts (press “New Query” button) as “Western European (Windows) – Codepage 1252”, yet when you click “Modify” to edit a stored procedure, for example, and then try and save the script it will, by default, save as “Unicode – Codepage 1200″… and these don’t concatenate together very well as already explained.
There seems to be know way within Management Studio to set a default for this, so unless I’m mistaken, we are stuck doing things manually. Here is how:
When you have the Save File dialog, click the little drop down box at the right of the “Save” button, and click “Save with Encoding…” option.
You can now select the type of encoding.
I had done a fair bit of work with Management Studio before I came across this small drop down on the save button. It’s not really obvious as I was expecting a drop down box on the actual dialog. Hopefully this will be helpful to someone else also.