Sql-server – Handling data encoding issues while loading data to SQL from Script (Notepad++)

encodingoraclescriptingsql serversql-server-2008

I'm pretty sure this is not a SQL Server problem.

I already asked a question HERE with an awesome explanation, BUT I still can't explain to the guys where I work that it has nothing to do with SQL Server collation or etc.

the situation:

We create scripts ( INSERTS/DELETS ) using ANSI.
We send these scripts to our clients.
Out clients run these scripts via SQLPLUS, SSMS, or any other method.

When they use something that is using ANSI, there's no problem.

BUT we would like to FORCE soomething, to tell them something like
"hey, you are running this script with a different encode, and some characters will be worngly formated, like an ã would be xE3.

is there a way to force a script to run on it's native encode ( the encode that I created )?

I really have no idea how to dead with this problem. We want to sent a script, and we want to be sure that this script will run with A being A, Ã being Ã.

Best Answer

One option might be to have them run the script via sqlcmd with the codepage options:

sqlcmd -f <codepage> | i:<codepage>,o:<codepage>

Alternately, save the source files with UTF-8 encoding (code page 65001), with a byte-order mark.