SQL SERVER – Tips from the SQL Joes 2 Pros Development Series – Wildcard – Querying Special Characters – Day 2 of 35

Answer simple quiz at the end of the blog post and -
Every day one winner from India will get Joes 2 Pros Volume 1.
Every day one winner from United States will get Joes 2 Pros Volume 1.

Querying Special Characters

Some special characters can be tricky to pattern match since they themselves can represent different values at different times. Let look at some examples. Here is a quick look at all the records in the [Grant] table of the JProCo database. Note: Since [Grant] is also a keyword it must be enclosed in square brackets or double quotes to designate it as the [Grant] table and now the keyword. Take a look at many of the names in the GrantName field and notice we have many names with special symbols in them. See figure below:

Finding literal % signs with wildcards

We learned about special characters in yesterdays post called wildcards. When using the percentage sign % or the underscore _ we can do relative searches. We have a grant called “92 Purr_Scents %% team” which has a percentage symbol in the name. We have other grants with percentages in their names. How do you search for a percentage sign with two wildcards on either side? It would appear to SQL that you’re looking for three wildcards as seen in the query below:

--Bad query pattern logic (finds all Grant records)
SELECT *
FROM [GRANT]
WHERE GrantName LIKE '%%%'

We have three special characters and no literal percent symbol. Help is on the way again with the square brackets. Take the wildcard you want to use as a literal percentage symbol and surround it with square brackets. You see two grants having a percentage symbol within their names. In this example the square brackets give you the literal percentage symbol. In this figure you see just the two grants that have a % sign in the name.

Finding literal _ signs with wildcards

You may know that the underscore is also a wildcard. We can use this to find a specifc second letter. How many Grants have the letter A for the second letter can be found with the following query:

--Find Grants where A is the 2nd letter.
SELECT *
FROM [GRANT]
WHERE GrantName LIKE '_A%'

GrantID GrantName EmpID Amount

6

TALTA_Kishan International

3

18100

10

Call Mom @Com

5

750

In this  example by asking for one character before the letter A and any amount afterward, we names like “TALTA_Kishan International” and “Call Mom @Com”. The % symbol wildcard can represent many characters while the _ symbol wildcard always represents exactly one.

To find the Grants with underscores in the name we do the same technique we used with the % wildcard. Again, we take the wildcard that you want to evaluate and put it inside square brackets.

You see three grants having underscores in their names (Figure 2.20). In this example the square brackets tell SQL you are looking for a literal underscore character.

Note: If you want to setup the sample JProCo database on your system you can watch this video.

Question 2:

Q 2.) You want to find all grant names that have an Underscore as the second letter. Which SQL code would you use?

  1. SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘
  2. SELECT * FROM [Grant]
    WHERE GrantName like ‘[_]_% ‘
  3. SELECT * FROM [Grant]
    WHERE GrantName like ‘_%[_]%_ ‘
  4. SELECT * FROM [Grant]
    WHERE GrantName = ‘_[_]% ‘
  5. SELECT * FROM [Grant]
    WHERE GrantName = ‘[_]_% ‘
  6. SELECT * FROM [Grant]
    WHERE GrantName = ‘_%[_]%_ ‘

Please post your answer in comment section to win Joes 2 Pros books.

Rules:

Please leave your answer in comment section below with correct option, explanation and your country of resident.
Every day one winner will be announced from United States.
Every day one winner will be announced from India.
A valid answer must contain country of residence of answerer.
Please check my facebook page for winners name and correct answer.
Winner from United States will get Joes 2 Pros Volume 1.
Winner from India will get Joes 2 Pros Volume 1.
The contest is open till next blog post shows up at http://blog.sqlauthority.com which is next day GTM+2.5.

Reference:  Pinal Dave (http://blog.SQLAuthority.com)

About these ads

189 thoughts on “SQL SERVER – Tips from the SQL Joes 2 Pros Development Series – Wildcard – Querying Special Characters – Day 2 of 35

  1. Correct answer is

    Option 1: SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Thanks
    Dhananjay Kumar

    India [Pune]

    [links removed]

  2. WooHoo…. I am the first to answer. My answer is

    1. SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘
    Reason – You need to put a underscore at the first place to say match 1 character and then escape the literal underscore in the second character followed by any character representation which is %

    2: is matching the literal underscore in the first character.

    3: is matching literal character anywhere in the length of the string

    4,5,6: dont stand a chance as the where clause is saying to find the grant name as the exact match of the right hand side instead of a pattern matching.

    crossing my fingers iWish iWin :)

    Thanks pinal for wonderful series.

    regards
    Lohith
    India [Bangalore]

  3. Answer 1

    The first _ is worked as a wild card and looking for next letter after anything in first. Second _ is actually a letter as it is covered with [], i.e. [_] and % means any letters from the third. So, _[_]% checks second letter as _ in a given GrantName. For searching a particular letter, we are using either LIKE, PATINDEX or CHARINDEX.

    Option 2 is searching Grantname starting with _.
    Option 3 is searching GrantName for _ anywhere in the string and same as ‘%_%’
    Options 4, 5, 6 are searching for exact match.

    Shekhar Teke
    Auckland, New Zealand

  4. Hi,

    This is Sathya from Chennai, India. The correct answer is option 1. Reason being, it has
    1. Like operator
    2. Looks for any character as the first letter by mentioning _ inside the the single quote as the first character
    3. It searches for exact _ match for thr second letter by specifying [_] as the second character inside the single quotes
    4. The resulted word can have any character after that. That’s the reason we are adding a % at the end inside the single quotes

  5. Correct answer is option 1 :

    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘

    because underscore is a wildcard character which signifies a single character and matches Underscore as the second letter

  6. Correct answer is option 1 :

    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘

    because underscore is a wildcard character which signifies a single character and matches Underscore as the second letter

    Country – India

  7. The correct answer is 1st option:

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    we want to look for names which have underscore at the second letter that’s why we have put simple underscore at first position (_ symbol wildcard always represents exactly one) and second underscore in square bracket (which we want to search)

    India

  8. Correct answer is Option 1

    because underscore is a wildcard character which signifies a single character and matches Underscore as the second letter

    INDIA (Pune)

  9. Correct answer is

    Option 1: SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Explanation : The underscore is a wildcard character which means a single character and it will matches Underscore as the second letter

    Thanks
    Prasad Yangamuni
    India [Pune]

  10. The correct answer is option 1.

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Find all grant names that have Underscore as the second letter. The first wildcard character _ searches for a single character. Next identifies the character specified within the [_] square bracket, followed by any number of character which is represented by %.

    by
    Yasodha.N (India)

  11. the correct is answer is
    option 1 : SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    because underscore will tell you from which character(i mean position) and underscore enclosed in square bracket will tell you that you have to find underscore in that column…

    i am from india

  12. Pingback: SQL SERVER – Win a Book a Day – Contest Rules – Day 0 of 35 Journey to SQLAuthority

  13. Correct Answer: Option 1: SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Explanation: As underscore is a wildcard character and we can use this to find a specific second letter with the LIKE operation.

    Country: India [Noida]

    All The best to everyone.. :)

  14. Option 1 is the right answer.

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Actually we want only one character before “_” sign, so we can’t put “%” there but we have to put “_”, after that we want to find second letter would be “_” but “_” has different meaning with LIKE operator so we have to use square bracket surrounding and after second letter “_”, there could be anything so we are using “%” sign.

    Ritesh (Gujarat, India)

  15. The correct answer is
    —————————-
    1. SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘

    Reason
    ———–
    The first underscore will match any single character at position 1(one) and the second underscore as enclosed in ‘[]’ will match it exactly as a literal followed by any zero or more characters due to the presence of ‘%’

  16. Correct Answer is

    1. SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Vishal from India(Delhi)

    Thanks for posting this knowledgeable series….

  17. Correct answer is

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]%’

    The above Query None of from 6 options.

    option 1 have extra space after % . so it wont give expected result(why because it search for space after [_]).

    Ranjit.. India,Hyderabad

  18. correct answer is option 1

    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘

    because underscore is a wildcard character which signifies a single character and matches Underscore as the second letter.

    Name : Bhargav Mistri
    Country : India

  19. The Answer is option 1

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Explanation
    * The fisrt “_” is telling that the first character can be anyone in the GrantName.
    * The “[_]” telling to sql is that the second character should be “_” (underscore)
    in the GrantName
    * The “%” is telling sql is that remaining can be anything in the GrantName.

    Govindaraj, Bangalore, India.

  20. My answer is 1st optuion.

    1. SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘
    Reason – You need to put a underscore at the first place to say match 1 character and then escape the literal underscore in the second character followed by any character representation which is %.

  21. My answer is 1st option.

    1. SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘
    Reason – You need to put a underscore at the first place to say match 1 character and then escape the literal underscore in the second character followed by any character representation which is %.

  22. My answer is 1st optuion.

    1. SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘
    Reason – You need to put a underscore at the first place to say match 1 character and then escape the literal underscore in the second character followed by any character representation which is %.

    Malay from Ahmedabad,INDIA

  23. Correct answer is Option 1:
    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]%’
    where first underscore is for any letter in the GrantName and second underscore embrace in [ ] is for underscore character and remaing part can be anything.

    Ahmedabad, INDIA

  24. Correct Answer : option 1

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    because the first ‘_’ represents a wildcard while the next one act as the charecter we want to search

    Thanks
    Santosh
    India

  25. Question 2. Answer is 1. (Country – UK)

    2,4,5,6 will give you empty result so that they are not the right answer for question 2.

    However… 3 is given you all result with ” which we don’t want. We only want ” as the second character. So answer is 1.

  26. option 1 is the answer

    first _ means you are looking for 2nd character specifically
    now [_] at 2nd position says we want this character at this position
    % says any character 3rd onwards

    vishal jindal
    country : india

  27. The Correct answer is

    Option 1: SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Thanks
    Mandar Alawani
    Mumbai, India

  28. Question 2:

    Q 2.) You want to find all grant names that have and Underscore as the second letter. Which SQL code would you use?
    Answer is
    1. SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Because ‘_[_]% ‘ represents

    _ —> Represents first character of the word that may be any character

    [_] —> ‘_’ character in ‘[”]’ square braces represents looking for this
    character the square brace will nullify(ignores) its(special character)
    meaning.

    % —> any number of character after [_]

  29. if u want display only second letter is ‘_’ then the option 1 is correct
    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]%’

    if we want disply second letter as well as any where in the name ‘_’ is exists
    option 3rd is coorect
    SELECT * FROM [Grant]
    WHERE GrantName like ‘_%[_]%_’

    country : India

  30. if u want display only second letter is ‘_’ then the option 1 is correct
    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]%’

    country : India

  31. Correct answer is option 1 :

    First _ will work as wildcard character and will result all the GrantNames.
    Second _ is in Square Brackets and will result all the GrantNames having _ as Second character.

    Country – India

  32. 1. Is the correct answer. The _ wildcard in the first position in the phrase after quotation ask SQL to litterally look for the second letter. The _ in square brackets ask SQL to sort by that symbol.

    Ron A. Farris
    Country – United States of America

  33. Correct answer :-

    Option 1

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    grant names that have and Underscore as the second letter find by

    ‘_[_]%’ pattern with like .. as second letter is Underscore which is wildcard
    so , put it into [ ] ..

    country: India

    Nice post …

  34. The correct answer is option 1:

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]%

    Reason: _ being a wildcard character, provides appropriate output required.

    Divya
    US

  35. Answer is Option 1 :

    Because 1st underscore defines that 1st character can be any thing and then [_] defines that it should not be treated as wildcard.

    India

  36. Good morning,

    I believe that the first one is correct.
    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    The reasons are: First, it must use the keyword “like” and not the equal sign. Second, the first underscore lets the first character be anything. Third, the underscore in brackets matches exactly the underscore and finally the wildcard ‘%’ will match anything after that.

    I am from the United States.

    Best Regards,

    Jeffrey

  37. Option 1 – is Correct answer.

    Option 2 – This code will find out first char as ‘_’ and 2nd Char will be any thing hence this is incorrect.

    Option 3 – In this code 2nd char can be any thing because of % , So this is also incorrect.

    Option 4,5,6 – will not work because of ‘ = ‘ in this case.

    I am from India.

    Thanks and Regards
    -Dnyanesh

  38. Answer: Option #1
    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Reason: The first underscore is a wild card, the second underscore in brackets matches the underscore exactly, and then % will match anything, which is exactly what we want for this query.

    Thomas Riehle
    USA

  39. answer is #1
    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘

    ‘_’ underscore with out bracket will read only one character (the first character) without any special comparison ‘[ _ ]’ underscore with bracket will read only the underscore symbol in the second character place and ‘%’ symbol will read any number of character following underscore ‘_’

    Place of residence : India

  40. Answer Is :

    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘
    Jigar badgujar, Country = india

    Explanation : As per SQL like syntax first underscore will be consider for any character at the first place and after that undderscore in brackets [_] will surely look for underscore char at the second place as it is placed on second place in like syntax and after that last % will go for any char after second underscore.

    Thanks,
    Jigar Badgujar

  41. The choice would be Option 1
    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    the first _ is a wildcard.
    The square brackets around the second underscore tells SQL that we are looking for a literal underscore character. The % will match anything after the underscore.

  42. sorry

    Correct answer is :

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Regards,
    Nilesh Pawar
    India [Mumbai]

  43. The Correct Answer is option 1

    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘

    Why Explanation

    1) The first underscore _ is for first character can be anything in first place.
    2) The [_] is for the second character should be _ (underscore) it will look for having underscore char in the second place.
    3)The Like operator with % in the last is telling SQL SERVER that remaining character can be anything after second underscore.

    Dilip Kumar Jena
    Country – India

  44. Shree

    Answer is :

    1.SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]%’

    1. The first Underscore will look for any one character.
    2. The second underscore with bracket will check for any name having Underscore as the second letter.
    3. The % is for any letters followed by underscore.

    Thanks,

    Shree

    Bangalore India.

  45. Hello ,

    I believe this is the correct answer

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    The first wildcard symbol _ always represents exactly any one character before or after the desired attribute , in our case as we are looking for the grant names that have Underscore as the second letter, so here we place the first _taking the first place and the second [_] as the second letter taking the second place……

    problem solved cheers!!

    USA

  46. Hi Pinal Dave,

    The correct answer is number 1

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Kind regards

    Andy
    Leeds, UK

  47. Option No. 1 is the one

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Thanks

    San Salvador (El Salvador)

  48. Option 1 is correct answer:
    This is because underscore is a wildcard character which signifies a single character and then matches underscore as the second letter.

    From USA.

  49. Question 2:
    Q 2.) You want to find all grant names that have and Underscore as the second letter. Which SQL code would you use?

    Answer:
    1.SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Answerer: Sivaprasad S

  50. Hi Pinal sir,
    Thank you for proving extended features of wildcards.

    The correct answer for this question is option no. 1:

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Reasons: We have to find all grant names as a second letter.
    Since underscore is also one of the wildcard used to match single character and we also have to find underscore as letter.
    It is very much clear that is you want to find any special character inside the string simply enclosed that letter into character class.
    By enclosing wildcard letter into character class it loose it special meaning and treated as ordinary character.

    We have used correct keyword like and _ as first letter bcoz we have to find second letter as underscore so there must be only one letter before underscore and _ wildcard is used to match only single character.
    Also we have to find _ underscore as second letter and its is wildcard so it must be enclosed into character class i.e.[] and it may be followed by any number of character.

    Following options are not correct because:
    Option 2:
    SELECT * FROM [Grant] WHERE GrantName like ‘[_]_% ‘
    Expression is not in correct sequence.

    Option 3:
    SELECT * FROM [Grant] WHERE GrantName like ‘_%[_]%_ ‘
    Incorrect pattern.

    Option 4:
    SELECT * FROM [Grant] WHERE GrantName = ‘_[_]% ‘
    Like must be used instead if = symbol.

    Option 5:
    SELECT * FROM [Grant] WHERE GrantName = ‘[_]_% ‘
    Expression is not in correct sequence and Like must be used instead if = symbol.

    Option 6:
    SELECT * FROM [Grant] WHERE GrantName = ‘_%[_]%_ ‘
    Incorrect pattern and Like must be used instead if = symbol.

    Thanks
    Chirag Satasiya(Mumbai – INDIA)

  51. Answer :

    1. SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘

    First character is valid for any character so _ is right and we want second one as _ so we enclose it in []-square braces.

    Name: Paurav
    Country: India

  52. Hi Pinal,

    This is a day late, but the correct answer is the first choice:

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Thanks for the quiz and the knowledge.

    Best Regards,

    Bill Pepping
    (United States participant)

  53. The answer is #1 “SELECT * FROM [Grant] WHERE GrantName like ‘_[_]%’

    #4,5 and 6 all have the “=” so they are out as they will not return what we are wanting
    #2 puts the “_” as the first letter
    #3 allows there to be more than one letter before the “_”

    Deb from the USA

  54. 1. SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘
    This is the best suitable answer as the first ‘_’ specifies that anything can be the first character. The second ‘_’ withing square brackets specifies that SQL Server only searches for _ as the second letter.

    2. SELECT * FROM [Grant]
    WHERE GrantName like ‘[_]_% ‘
    This will not work as it will return any thing as the second letter and not ‘_’ as second letter as expected.

    3. SELECT * FROM [Grant]
    WHERE GrantName like ‘_%[_]%_ ‘
    This will not work as it will return any thing as the second letter and not ‘_’ as second letter as expected.

    Below options will not return as expected due to the presence of the ‘=’ operator
    SELECT * FROM [Grant]
    WHERE GrantName = ‘_[_]% ‘
    SELECT * FROM [Grant]
    WHERE GrantName = ‘[_]_% ‘
    SELECT * FROM [Grant]
    WHERE GrantName = ‘_%[_]%_ ‘

  55. Number 1 is the closest, but there is an empty space char at the end of each of the string literals, so that would cause ALL to be invalid.
    Here is the correct version:
    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]%‘
    USA

  56. Answer: Option #1
    Explanation: The first underscore ‘_’ is treated as a single character wildcard. The second underscore in square brackets [_] is treated as a literal character to search for. Option #4 is not correct because it uses an ‘=’ instead of LIKE.
    Country: USA

  57. Hi dave,

    Correct answer is option 1 :

    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘

    because the first underscore is acts as a wildcard character which signifies a single character and matches Underscore as the second letter

    From
    India

    Chitti :-)

  58. Correct answer is option 1 :

    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘

    Reason: underscore is a wildcard character which signifies a single character and matches Underscore as the second letter

    Country – India

  59. The correct answer is #1.

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    As we are required to search “_” as second character, specifying and “_” before and second “_” in brackets with wild card will give you all the GrantName that has second character as “_”.

    Syed from USA.

  60. The correct answer is Option 1:

    SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    Option 4, 5, and 6 use the ‘=’ operator and would not work because they would find an exact match. The wild cards are only valid in a LIKE statement. Option 2 gives us any record with the underscore as the first character (and looks like bad sql because the second character is a wildcard and is unnecessary since there is a %. Option 3 is also bad sql but would find any value that contains an underscore. Option 1 uses the _ for the wild card in the first character position, looks for the literal underscore in the second position and then any value afterwards.

    Country of Residence: USA

  61. Correct answer is

    1: SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    first _ is to say we are looking for 2 character for pattern matching and
    [_] is to say we are looking for _ as matching character.
    Then % for characters on wards.

    Ghanshyam Patel
    Ahmedabad
    India

  62. very helpful article. Option 1 is the correct answer. sounds like something i should consider putting into constraints sometimes too.

  63. Replying after 1st reply on a public forum; can not be any fun. The answer should go to someother place and then result ( with winnder with explanation) to be published here on this blog. Besides, seeing all 146 answers and scrolling for life, with the same reply, ditto copies , will not add value

  64. Answer : Option 1
    Wildcards (%) only work with the LIKE keyword so (4), (5) and (6) are all incorrect. LIKE ‘[_]_% ‘ would only match strings where the first character is an _ and has at least one letter after that so (2) is also wrong. The correct answer is (1) because the first _ forces one character of any type and the second one (in square brackets) must be a literal underscore.

    A.Arul Prakash

    Country : USA

  65. The correct answer is 1.
    First _ tell sql we are looking for second letter.
    Second _ with [] tell sql that _ is the character we are looking for.

    Country – Canada

  66. The Correct answer is

    Option 1: SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    and nice have quiz like this

    Country – India

  67. Q 2) SQL SERVER – Tips from the SQL Joes 2 Pros Development Series – Wildcard – Querying Special Characters – Day 2 of 35

    Answer: Wildcards (%) only work with the LIKE keyword so (4), (5) and (6) are all incorrect. LIKE ‘[_]_% ‘ would only match strings where the first character is an _ and has at least one letter after that so (2) is also wrong. The correct answer is (1) because the first _ forces one character of any type and the second one (in square brackets) must be a literal underscore.

    Winner from USA: Chuck Lathrope

    Winner from India: Chirag Satasiya

    I thank you all for participating here. The permanent record of this update is posted on facebook page.

  68. Pingback: SQL SERVER – The SQL Hands-On Guide for Beginners – Book Available for SQL Server Certification Journey to SQLAuthority

  69. Hello guys,
    I am suffering a problem with this.
    I want to find procedures list which involes the object [MA].[Employee]

    SELECT name,object_definition(object_id)
    FROM sys.procedures
    WHERE object_definition(object_id) like ‘%[MA].[Employee]%’

    But it is not working properly.
    can anu one give a solution for this

    Thanks & Regards
    Srikanth Nallamothu

  70. Answer #1 is correct.
    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]%’
    Here _ will skip 1st character & [_] will pick all the GrantNames whose 2nd character is _.
    Dheerendra Pandey
    India(New Delhi)

  71. Correct Option is 1.
    SELECT * FROM [Grant] WHERE GrantName like ‘_[_]% ‘

    Explanation: In Like _ is used for single character and to search _ in character list we use square brackets.

    India [Noida]

  72. The Correct answer is 1#

    1.SELECT * FROM [Grant]
    WHERE GrantName like ‘_[_]% ‘

    ShashiKanth Pusa
    United States

  73. Pingback: SQL SERVER – Query Hint – Contest Win Joes 2 Pros Combo (USD 198) – Day 1 of 5 « SQL Server Journey with SQL Authority

  74. Pingback: SQL SERVER – Weekly Series – Memory Lane – #040 | Journey to SQL Authority with Pinal Dave

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s