Microsoft
Software
Hardware
Network
Question : Encoding Escape Characters In SQL Statements Executed Through PowerShell
Hello,
I am attempting to execute a an SQL query through PowerShell against an MS Access database. My query works 99% of the time, but occasionally a localized string will cause an error beacuse it contains a single quote (') somewhere within the localized string. You can look at the following example to get a better idea of what I am talking about:
SELECT TermNo, File, Context
FROM ExceptionFC
WHERE TermNo = 1
AND File = '\\fr\Content\fr_localized
_content.x
ml'
AND Context = '(le second niveau), lequel doit accéder aux ressources d'un serveur de base de données ou d'un partage réseau (le troisième niveau). Le jeton de sécurité principal utilisé entre le navigateur et le s'
In most languages I could add slashes to this string to escape out the single quotes (') in the string. But I don's seem to be able to do that in PowerShell.
Is there a way I can execute this query within PowerShell and receive an accurate response back from the database?
Thank you.
Answer : Encoding Escape Characters In SQL Statements Executed Through PowerShell
> .. "Syntax error (missing operator) in query expression
sounds like an error from yur db
As I already said: you need to double single quotes in your text *before* you pass it to the database.
Random Solutions
How to install Symantec Mail security for Exchange
How do I perform this shell command in reverse?
Cognos8 configuration
What does 'Cannot Create Transaction because Capacity was Exceeded' mean?
Unable to Modify Exchange 2003 Send/Recieve Restrictions
C# Outlook Add-in to add signature dynamically on reply / forward
EXCEL: Putting data labels automatically on a scatter graph.
Error: STOP c000021a -status 0x00000080
Problem sending to cfl.rr.com domain
what is the syntax to add a new user?