Can SQL Statements do Non-case Sensitive Searches?

Results 1 to 2 of 2

Thread: Can SQL Statements do Non-case Sensitive Searches?

  1. #1
    Join Date
    Dec 1969
    Posts
    294

    Default Can SQL Statements do Non-case Sensitive Searches?

    I created the following ASP Script to search a database. But I find it is 100% case sensitive. How do I make my SQL searches non case sensitive? <BR><BR>&#060;%@ LANGUAGE=VBSCRIPT %&#062;<BR>&#060;HTML&#062;<BR>&#060;HEAD&#062;<BR >&#060;TITLE&#062;THIS SCRIPT FINDS DUPLICATE EMAIL ADDRESSES &#060;/TITLE&#062;<BR>&#060;/HEAD&#062;<BR>&#060;BODY&#062;<BR>&#060;% If Request("Email")= "" then %&#062;<BR><BR>&#060;FORM method=POST action="SearchnDisplay.asp"&#062;<BR>Input Value Please:<BR> <BR> &#060;INPUT TYPE=TEXT NAME="Email" SIZE=30&#062; &#060;P&#062; <BR> &#060;INPUT TYPE=SUBMIT value="submit"&#062;<BR>&#060;/FORM&#062;<BR><BR>&#060;% Else %&#062;<BR><BR>&#060;%<BR>&#039get info from the form<BR>Dim Email, NumRecords<BR>Email=Request("Email")<BR>NumRecords =1<BR><BR><BR> &#039Establish a connection with data source <BR> strDSN = "FILEDSN=Practicing1.dsn" <BR> Set cn=Server.CreateObject("ADODB.Connection")<BR> cn.Open strDSN<BR><BR> &#039Instantiate a Recordset object<BR> Set rsCustomers = Server.CreateObject("ADODB.Recordset")<BR> <BR> &#039Open a recordset using the Open method<BR> &#039 and use the connection established by the Connection object<BR> strSQL = "SELECT EmailAddress FROM EmailTable"<BR> rsCustomers.Open strSQL, cn <BR> <BR> &#039Cycle through record set and display the results<BR> &#039 and increment record position with MoveNext method<BR> Set objFirstName = rsCustomers("EmailAddress") <BR> Do Until rsCustomers.EOF <BR> If objFirstName = Email Then Response.Write objFirstName & " found it at record number " & NumRecords &"<BR>"<BR> NumRecords = NumRecords + 1<BR> rsCustomers.MoveNext<BR> Loop<BR> Response.Write NumRecords & " =Total Number of records "<BR>%&#062;<BR><BR>&#060;% End If %&#062;<BR><BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;<BR>

  2. #2
    John Weeeflaar Guest

    Default RE: Can SQL Statements do Non-case Sensitive Searc

    You can convert both sides to uppercase when comparing:<BR><BR>If Ucase(objFirstName) = Ucase(Email) Then ... <BR><BR>Cheers,<BR><BR>John<BR><BR>

Posting Permissions

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