Link to home
Start Free TrialLog in
Avatar of frankEQS
frankEQS

asked on

Invoke-sqlcmd problem - special characters replaced with "?"

I have a problem when invoking sql scripts with the use of invoke-sqlcmd.

Every spesial character i use (like Æ, Ø and Å) are being replaced with a ?.

This does not happen when i manualy load these scripts in management studio.

SQL server 2008
Powershell 2.0

My code to run the scripts

invoke-sqlcmd -InputFile $create_clean -ServerInstance $sql_server -database $dbname -ErrorAction "silentlycontinue"

Open in new window


Here is a dude with the exact same problem!

http://www.sqlservercentral.com/Forums/Topic1159860-1351-1.aspx


Please help!!
SOLUTION
Avatar of YZlat
YZlat
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of frankEQS
frankEQS

ASKER

I did solve this with using a another way (sqlcmd.exe), thou did not solve the "original Q" on how to make invoke-sqlcms not escape special characters.

I have not looked into YZlat solution.