 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
Escape "|" in snippets |
|
Is there a way to escape pipe ("|") and "$" in snippets?
|
|
Tue Jul 24, 2012 7:21 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Try using database functions like 'some text' + CHAR(36) + 'more text' to insert dollar and pipe symbols dynamically.
Note that ASCII code 36 returns $ symbol, and code 124 returns | symbol. Hope this helps.
|
|
Tue Jul 24, 2012 9:41 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Yes, it does. Actually, I had to replace several '$'s and '|'s with '$$SELECT CHAR(36)$$'s and '$$SELECT CHAR(124)$$'s (apostrophes included) but it worked very well, thank you very much.
By the way, the snippet is some 3.7k lines and makes the snippet editor pretty slow. I had to tailor it in the Management Studio. I suppose it wasn't designed to work with vast number of lines. What's the recommended maximum?
|
|
Tue Jul 24, 2012 5:42 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
You are right, that snippet editor is not designed for large scripts, it is based on the standard Windows Rich Edit control with dynamic syntax coloring, so my wild guess is that couple hundred lines of code or less should be ok, but anything more than that should slow it down dramatically causing slow text repainting after each key press and mouse move.
I bet you have set a record in terms of number of lines of code in a single code snippet. :-) Out of curiosity, what does your snippet do?
|
|
Tue Jul 24, 2012 6:15 pm |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Not mine, to be honest. It's a maintenance solution script created by Ola Hallengren (check it here). Most of his solutions are more sophisticated than mine are, so I've decided to replace them. I imported it as a snippet and added a large number of parameters (backup directories, log retention days, index maintenance criteria, database names, etc.) that are set using SA prompts at snippet invocation. I also customized procedure calling in SQL Agent jobs here and there but it's mostly intact.
I could load the file and edit the settings manually but it's much easier to let SA do that. As you've probably guessed by now, I'm extremely lazy when it comes to repetitive tasks :)
|
|
Tue Jul 24, 2012 7:01 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|