Red Gate forums :: View topic - escape character
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Search 2
SQL Search 2 forum

escape character

Search in SQL Search 2 forum
Post new topic   Reply to topic
Jump to:  
Author Message
james.elmer@live.com



Joined: 09 May 2014
Posts: 1
Location: State College, PA

PostPosted: Fri May 09, 2014 4:56 pm    Post subject: escape character Reply with quote

I am trying to search for text that actually contains a % character in TSQL code.

For example, I have a product named 'ProductName' and SQL code that looks for it by this query:

WHERE product LIKE 'ProductN%'

I'd like Sql Search to limit the results by including the %

Sql Search text: 'ProductN%'

Is it possible to escape the % so sql search matches the % character?
_________________
James
Back to top
View user's profile Send private message
dom.smith



Joined: 03 Jun 2010
Posts: 94
Location: Cambridge, UK

PostPosted: Fri May 16, 2014 3:33 pm    Post subject: Reply with quote

Hi,

As you've probably realized, when you type a '%' character, SQL Search always interprets it as a wildcard, including in 'Exact Match' mode.

However, I'm not sure why this would be a problem for you, because wildcard '%' will match the literal '%' character.

So, when you search for 'ProductN%', that should give the result you want (although there may also be other results for 'ProductNumber', for example, since this would also match 'ProductN%').

I hope that makes sense. If it isn't working as I've described, please let me know here, including which version of SSMS and Operating System you are using.

Thanks,

Dom.
_________________
Dominic Smith,
Project Manager,
Red Gate Software.
Back to top
View user's profile Send private message
benik9



Joined: 09 Jul 2013
Posts: 3

PostPosted: Tue May 27, 2014 2:43 pm    Post subject: There are cases when we need to search for '%' Reply with quote

In our objects, we use a code value to describe a logic. For example, when 'A%' then aaa when 'B%' then bbb.

I wish redgate search can search for a '%' character.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
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