codebrothers.net :: Home  >  Matthias Denkmaier
User: Guest  Login
Matthias Denkmaier
C# - what else?
Blog search:  
How to: Ensure correct german characters in SQL scripts using sqlcmd.exe

The command line tool sqlcmd.exe is well known in the world of a Microsoft (SQL Server) developer.
Normally you will execute SQL scripts using the following syntax:

 

sqlcmd.exe -E -S <your_server> -d <your_database> -i <your_script_file>

 

Everything is ok as long as the script file does not contain german characters like ä, ö, ü and so on.
Otherwise you will encounter a problem with these special characters which ends up with malformed characters in the database.

 

The solution is simple, but as far as i known, not documented.

 

The input file which you specify with the -i parameter at the sqlcmd.exe command line tool takes UTF-8 encoded files.

All other script file with a different encoding end up with the same problem when you have german special characters included.

So ensure that your SQL script files are always saved as UTF-8 and it will save your day.

Share this post: Email it!
Posted:  5/11/2007 9:29:00 AM  by  mdenkmaier
Tags:  SQLHow toDevelopment
No comments, yet!
Leave a Comment

Name required

Your URL

Comments (required)