SQL string

Results 1 to 2 of 2

Thread: SQL string

  1. #1
    mikebose Guest

    Default SQL string

    I have a query on an ASP page :<BR><BR>MyRecordsetObject.Open "SELECT * FROM ajax.sample_reports3 where name=&#039;" & Request.QueryString("name")& "&#039;" , "DSN=nirvana"<BR><BR>When the name is something like: SMITH, JOHN A., the query runs fine and retrieves the relevant data from sample_reports3(which is a view). However when the name is something like : SMITH, JOHN A (without a period after the middle initial), the query does not work.The name datatype is varchar2(150)<BR><BR>In some cases, i right-trimmed the name and added a period, and the query worked. What could the problem be?

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL string

    In SQL, = means just that... it has to match exactly:<BR><BR>SMITH, JOHN &#060;&#062; SMITH,JOHN &#060;&#062; SMITH, JOHN A &#060;&#062; SMITH, JOHN A.<BR><BR>You may want to use LIKE &#039;% & name & "%&#039;<BR><BR>Will return all matches, including<BR><BR>SMITH, JOHN Anthony<BR>SMITH, JOHN A<BR>SMITH, JOHN A.<BR><BR>Look up what else the LIKE operator can do... you may also want to see IN.

Posting Permissions

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