SOLVED

How to escape a password containing a backslash \ in azure SQL server database connection string

Copper Contributor

Hello, I have a password that contains a \ and I tried to escape using a double backslash and it is not working. Anyone has another solution. Thanks

3 Replies
best response confirmed by Kadeabdul (Copper Contributor)
I got that resolved but I am still getting an error:
There was an error while overriding 'Password' parameter because of 'SyntaxError: Unexpected number in JSON at position 8', make sure it follows JavaScript Object Notation (JSON)
you'll use a double backslash "\" to represent a single backslash in your password. Here's an example of how you can store a password with a backslash in a SQL Server database:

Suppose your password is: "my\password" (with a backslash in it).

You should insert it into the database like this:
INSERT INTO Users (Username, Password)
VALUES ('myusername', 'my\\\\password');

Mark as Answer if it helps
1 best response

Accepted Solutions
best response confirmed by Kadeabdul (Copper Contributor)