The forum will be unavailable for maintenance at some point from Friday, April 13 at 19:00 EDT until Sunday, April 15 at 23:59 EDT. Downtime will be minimized but the exact timing is unknown.

I have a procedure where I have a UNC path as IN parameter. The IN paramater is handled as a varchar. I write '\\test\temp\filetest.txt'. But the path is not working in the procedure because all bakslash disappear except one? In the procedure, the path will be '\test\temp\filetest.txt'? Why, and how do I solve the problem?

asked 15 Mar '16, 17:34

Rolle's gravatar image

accept rate: 0%

edited 15 Mar '16, 17:35

Backslashes are used to escape special characters (e.g. \n represents a newline character). When a backslash precedes a character (or character sequence) that is not a valid escaped character then the backslash is left alone.

If you intend for a backslash to not be an escape sequence in a string you need to double up the backslash.

You can read more about escape sequences in SQL strings in the documentation.


permanent link

answered 15 Mar '16, 17:48

Mark%20Culp's gravatar image

Mark Culp
accept rate: 40%

edited 16 Mar '16, 08:17

IN to the procedure is '\\test\temp\filetest.txt'. Four backslashes first and two between. That will retun '\test\temp\filetest.txt' in the procedure.

So you mean that I should write '\\\test\\temp\\filetest.txt' IN to the procedure? Six backslashes first and four between.

(16 Mar '16, 03:23) Rolle
Replies hidden

Four backslashes first and two between. That will retun '\test\temp\filetest.txt' in the procedure.

That's unusual, it should be used as



Do you use EXECUTE IMMEDIATE within the procedure? - If so, note that this may mean you have to "double" the doubled backslashes again or use the WITH ESCAPES OFF clause, see the cited doc page.

(16 Mar '16, 03:35) Volker Barth

It may also depend on how you call the procedure. For example, if you're calling dbisql -c ... call myproc('\\\\test\\temp\\filetest.txt') from a command shell, the command shell itself may use the same escaping. You may need to double the backslashes twice, i.e. 8 at the beginning and 4 as directory separators.

(16 Mar '16, 08:10) Graeme Perrow
Replies hidden

...and sometimes you can get away with using a single forward slash to represent a single back slash in a SQL Anywhere string literal. The word "sonetimes" is a warning that sometimes you are NOT coding a SQL Anywhere string literal but a Windows command string literal so your results depend on the context.

And watch out for Ba'al...

(16 Mar '16, 10:02) Breck Carter
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 15 Mar '16, 17:34

question was seen: 576 times

last updated: 16 Mar '16, 10:13