[ ] (Wildcard - Character(s) to Match) ?

Discussion in 'ASP .Net' started by Bruce Lawson, Apr 19, 2006.

  1. Bruce Lawson

    Bruce Lawson Guest

    Hi, I am confused about Microsofts description of this Transact SQL
    reference; [] (Wildcard - Character(s) to Match. The description says
    "Matches any single character within the specified range or set that is
    specified inside the square brackets". For example, in the TransactSQL
    statement "UPDATE tblUsers SET [Password] = stringUserPassword WHERE UserId
    = 2" , what do the brackets signify about the database record in column
    Password being updated? TYIA
    BruceL
     
    Bruce Lawson, Apr 19, 2006
    #1
    1. Advertising

  2. The [] have two meanings. The one you described is only applicable inside a
    string with the LIKE operator...ala:

    select blah from blahTable where description like '[ab]oat'

    which doesn't really make sense, but you get the idea..

    outside of this case, [] is used to escape reserved keyword names. Password
    is actually a reserved word in TSQL, so the only way you can safely use it
    as a column/table/sproc name it to wrap it in []. You can often omit the []
    for reserved words, and TSQL will figure out what you mean, but I'd advise
    against it.

    If you type a query and a column name/table turns blue (or whatever color
    your SQL syntax turns, like the word SELECT or FROM) than you should put it
    in [] :)

    Karl

    --
    http://www.openmymind.net/



    "Bruce Lawson" <> wrote in message
    news:...
    > Hi, I am confused about Microsofts description of this Transact SQL
    > reference; [] (Wildcard - Character(s) to Match. The description says
    > "Matches any single character within the specified range or set that is
    > specified inside the square brackets". For example, in the TransactSQL
    > statement "UPDATE tblUsers SET [Password] = stringUserPassword WHERE
    > UserId = 2" , what do the brackets signify about the database record in
    > column Password being updated? TYIA
    > BruceL
    >
    >
    >
     
    Karl Seguin [MVP], Apr 19, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ravi

    Filename wildcard match

    Ravi, Nov 4, 2003, in forum: XML
    Replies:
    1
    Views:
    868
    Patrick TJ McPhee
    Nov 4, 2003
  2. Jon Perez
    Replies:
    1
    Views:
    1,079
    Peter Otten
    May 28, 2004
  3. Patrick  Hall
    Replies:
    2
    Views:
    2,007
    Josiah Carlson
    Jun 4, 2004
  4. Mr.SpOOn

    wildcard match with list.index()

    Mr.SpOOn, Nov 10, 2008, in forum: Python
    Replies:
    4
    Views:
    294
    Sion Arrowsmith
    Nov 19, 2008
  5. Replies:
    7
    Views:
    841
Loading...

Share This Page