[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 936
  • Last Modified:

Problem with PowerShell SQL update character

I have a PowerShell script that is running an Update query to a list of servers, but somehow a character keeps disappearing when the command executes.

I'm trying to update the record to 'EHASH\VIeuCdf~euko`ep`MRMpJ@'
But instead it updates to 'EHASH\VIeuCdf~eukoepMRMpJ@'

Somehow the ` character is dropped, does anyone know why?
0
JenH2
Asked:
JenH2
  • 3
  • 2
1 Solution
 
JenH2Author Commented:
Ok, so I see that ` is a special escape character, so now the quest is how do I get that character to be used as part of a text string?
0
 
JenH2Author Commented:
Nevermind, figured it out.
0
 
dicconbCommented:
Can you post how you did it, in case someone else wants to know?

Cheers,

D
0
 
JenH2Author Commented:
Originally my update was like this:

UPDATE table SET column = 'EHASH\VIeuCdf~euko`ep`MRMpJ@' WHERE something = something

To get it to work I did this:

$newdata = 'EHASH\VIeuCdf~euko`ep`MRMpJ@'   <--you need the single quote around the string so it won't treat ` as an escape.
UPDATE table SET column = '$newdata' WHERE something = something
0
 
dicconbCommented:
Thanks! D
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now