Simple Question -- a literal %

Results 1 to 3 of 3

Thread: Simple Question -- a literal %

  1. #1
    SPG Guest

    Default Simple Question -- a literal %

    In the near future, I&#039m going to need to put literal % symbols into Select statements. I&#039m hoping somebody has the 5-second answer to spare me a battery of tests... For MS SQL Server, how do I do it? %%, %, or something really really strange? (does the same convention apply to the _ wildcard as well?)<BR><BR>TIA.

  2. #2
    Join Date
    Dec 1969

    Default RE: Simple Question -- a literal %

    You just have to specify the escape character (!, etc)<BR>...where fieldname like &#039%5!%&#039 escape &#039!&#039<BR>See SQL Server BOL, section on wildcard pattern matching

  3. #3
    SPG Guest

    Default Wouldn't have guessed that; thanks.

    &#060;rant&#062;<BR>How ever did a "Oh, just write your own standard in a longhand, roundabout, never before seen syntax" get put into a programming language? Geez, even Perl&#039s regular expression engine (which I, in my limited experience, believe to be perhaps the most convoluted chunk of base code for its level of utility) isn&#039t *that* far out with it&#039s user-definable syntax...<BR>&#060;/rant&#062;<BR><BR>Then again, should we be surprised that this sort of thing pops up in a language which uses % (as opposed to the file system standard *) as a string wildcard?<BR><BR>"Laziness, Impatience, Hubris!" -- Larry Wall

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts