What is the Escape character for SQL snippet file - sql

I am writing a SQL Snippet in VS2010 and I want to have "$" as a character inside the SQL Snippet, but the way the snippet recognize a variable is by bounding a word with "$". EX: $var1$
Anybody know what the escape character is for SQL Snippet in VS2010, so it won't think of it as a variable by mistake?
Thank You.

You should be able to escape it by doubling it - try $$.

Use $$ (from here: http://conceptdev.blogspot.com/2006/08/visual-studio-2005-snippets-literal.html).

Related

BigQuery - Illegal Escape Sequence at REGEXP_REPLACE

I'm having an issue matching regular expression in BigQuery.
REGEXP_REPLACE(tc.metadata->>'document_number', '\D', '', 'g') = m.document_number
However, BigQuery doesn't seem to like escape sequences for some reason and I get this error that I can't figure out:
Syntax error: Illegal escape sequence: \D
This code works fine, but BigQuery is unhappy with it and I can't figure out why. Thanks in advance for the help
You need to double escape the the character in BigQuery, as the first / will be consumed by JavaScript.
Try double escaping, e.g. \\D and that should work for you.
In [1] if you scroll down you can see the escaping sequences of standard SQL and none is \D, so as Ben P says, you need to double escape to have the backslash escaping sequence. I assume it's what is missing but if you could elaborate further your question the answer would be indeed more accurate.
[1] https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#string_and_bytes_literals

Visual Studio Code Snippet Variable Transform not working

I'm trying to make a snippet that inserts the last two directorys of the current filepath.
My code:
${TM_DIRECTORY/\\(.*)\\([a-zA-Z]+)\\([a-zA-Z]+)/$1\\$2/}
So when Filepath is
"...\htdocs\projectname\src"
the output should be
"projectname\src".
But instead I get this result:
${TM_DIRECTORY/(.*)\\([a-zA-Z]+)\\([a-zA-Z]+)/$1/}
What am I doing wrong?
Problem:
The issue is the code converts \\ to \. For example if you want to write \w, then you have to write \\win snippet.
The same way.. You have to write \\\\ in snippet json, so that it shall convert into //.
Solution:
${TM_DIRECTORY/.*?\\\\([a-zA-Z]+\\\\[a-zA-Z]+)$/$1/}
or, I think you should use \w instead of [a-zA-Z] because the directory name can contain some characters like - or _ etc.
${TM_DIRECTORY/.*?\\\\(\\w+\\\\\\w+)$/$1/}

Regular expression for date in selenium ide

I tried to create a regular expression for the below date format, where as I am unable to justify that, please help me out.
04-Apr-2013 [10:58:13 GMT+05:30]
This is what I came up with:
\\d{2}-\\w{3}-d{4} [\\d{2}:d{2}:d{2} \\w{3}+\\d{2}:d{2}]
Correct me where i have gone wrong.
Thanks
You have to escape the square brackets as they have a special meaning in regular expressions and also some of your digit indicators doesn't have backslash prefix. I've tested the following regex and it worked for me:
regexp:\d{2}-\w{3}-\d{4} \[\d{2}:\d{2}:\d{2} \w{3}\+\d{2}:\d{2}\]

How do I escape the # character in Cognos?

I have created a pass-through Query Item in Cognos 8 Framework Manager that requires the # character as part of the query. Unfortunately this gets interpreted by Cognos as the opening of a macro.
How do I escape the # (number sign/sharp) character in a Query Item?
There does't seem to be any "official" way in the documentation, but this seems to work.
#"#"#
#'#'# works too, unless it appears in a literal SQL string in your query, so it's safer to use #"#"#.
A single backslash \ should delimit it, I know it delimits square brackets [].

Is there a tool for finding the Char code of a character?

I am trying to write a VB function to strip unwanted characters from a string. It is for generating a 'clean' url from data that has been inputted into a CMS. Someone has copied and pasted from a Word document and so there appears to be an mdash or ndash in the product title. This results in ─ appearing instead of -
I have tried a Replace(text, Chr(196), Chr(45)) but it isn't working so it can't be 196. Is there a tool or something where I can copy this character and paste it into the tool and it will tell me what char code it is?
Thanks.
You can make your program write out the Character Code using the finction Asc()
Response.write Asc("-") would write out
45
for example.
Try here or here. From 2nd link I can see that your char is alt150