Special Character in select statement.

  • How can I write select statement for

    "STICHTING WERELDHULP-BELGIE

    beginning of the sentence with " and ending the sentence ?

    Thx.

  • could you post a before and after example for us please?

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • How can I write select statement for

    the data beginning with "

    "STICHTING WERELDHULP-BELGIE

    and data ending the sentence ?

    V.Z.W."

    Thx.

  • Sorry I'm still not sure what you want to do???

    Could you give me an example.

    e.g

    Input : "STICHTING WERELDHULP-BELGIE

    OUTPUT : "STICHTING WERELDHULP-BELGIE ?

    or what ever it is that you want us to do

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • I want to check whether the begining of the data is "

    for this case "STICHTING WERELDHULP-BELGIE

    select left([name], 1) from table1 where left([name], 1) =" " " and right([name], 1) =" " "

    then it will return this row;

    NameAddress 1Address 2CityProvinceStateZip

    """STICHTING WERELDHULP-BELGIE""V.Z.W."""XX

    Thx.

  • 🙂

    Thanks

    You need to use single quotes around the double quotes

    DECLARE @table1 TABLE

    ([name] VARCHAR(100))

    INSERT INTO @table1

    SELECT '"STICHTING WERELDHULP-BELGIE"'

    select left([name], 1) from @table1 where left([name], 1) ='"' and right([name], 1) ='"'

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • but it is in MS ACCESS. I tried to put single quote. It did not work.

  • oh sorry about that.

    try this

    select left([name], 1) from table1 where left([name], 1) ="""" and right([name], 1) =""""

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • thx. how to explain this syntax:

    """" I assumed this " is escape. Thx.

  • mmm you basically just wrapping you " in Quotes but it seems wierd cause there are 4 of them I know.

    Sorry I'm not 100% sure how to explain this...

    But basically if you have "" (two Quotes) surrounded buy a set of Quotes.

    e.g "12345""12345"

    That will turn the two quotes in the middle to be 1 when printed or views.

    so the result here will be 12345"12345

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • Both statements work for me in Access:SELECT '"STICHTING WERELDHULP-BELGIE"'

    SELECT """STICHTING WERELDHULP-BELGIE"""

    Ronald HensbergenHelp us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/-------------------------------------------------------------------------2+2=5 for significant large values of 2

  • Ha, I guess I was too slow answering, or I didn't read the whole thread first...

    Ronald HensbergenHelp us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/-------------------------------------------------------------------------2+2=5 for significant large values of 2

  • nah it's cool I been editing my posts 🙂

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • I do not think I understand that quoto well. in the report table name field.

    I have those data in the access table

    "Abu Al-Hasan Al Madani"

    I need to take off the " " and come out as

    Abu Al-Hasan Al Madani

    according to Chris. my where condition should be """".

    but MS ACCESS just added five quot ( """"") for me

    Dim strQ As String

    strQ = "UPDATE report SET report.Name = left([report]![Name],2) WHERE Left([Name],1)="""""

    CurrentDb.Execute (strQ)

    strQ = "UPDATE report SET report.Name = Mid([Name],1,Len([Name])-1) WHERE right([Name],1)="""""

    CurrentDb.Execute (strQ)

    Thx.

Viewing 14 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic. Login to reply