SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Escape "|" in snippets

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Escape "|" in snippets
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Escape "|" in snippets Reply with quote
Is there a way to escape pipe ("|") and "$" in snippets?
Tue Jul 24, 2012 7:21 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
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 View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
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 View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
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 View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.