SQL Statement question

Results 1 to 4 of 4

Thread: SQL Statement question

  1. #1
    Join Date
    Dec 1969

    Default SQL Statement question

    I am trying to pull data from an AS/400 Database (which I have done successfully 100&#039;s of times before) and my SQL statement is not catching the data that I need.<BR><BR>Example:<BR><BR>The File contains Three Fields:<BR>RCD - Record ID<BR>USER - A User Name<BR>FCODE - List of Factory Codes that the User has authority to view separated by a "&#124" to be "Split" in the ASP.<BR><BR>I use the Following SQL:<BR><BR>SQL = "Select * from TABLE.FILE Where USER = &#039;Administrator&#039;"<BR><BR>This returns nothing...but if i do this:<BR><BR>SQL = "Select * from TABLE.FILE"<BR><BR>While rs.eof = false<BR> If rs("USER") = "Administrator" Then<BR> Response.Write rs("USER") & " = Administrator"<BR> Else<BR> Response.Write rs("USER") & " &#060;&#062; Administrator"<BR> End If<BR> rs.movenext<BR>Wend<BR><BR>It Returns:<BR><BR>Bob &#060;&#062; Administrator<BR>Bill &#060;&#062; Administrator<BR>Administrator = Administrator<BR><BR><BR>So I know that the User Field is Correct but i can&#039;t get the SQL statement to capture the specific record that i need. What should I try?

  2. #2
    johnny rocket Guest

    Default RE: SQL Statement question

    Are you debgging the query properly? Try using response.write and make sure it is exactly what you want.<BR><BR>

  3. #3
    J. Paul Schmidt Guest

    Default Drop the Dot

    You wrote that you have a problem with the following SQL statement:<BR><BR>SQL = "Select * from TABLE.FILE Where USER = &#039;Administrator&#039;" <BR><BR>I would suggest NOT putting a period in the table name. So perhaps use a table name like tblFile instead of TABLE.FILE. Actually TABLE.FILE in a SQL statement would mean to use a field called FILE from a table called TABLE.<BR><BR>Best regards,<BR>-Paul<BR><BR>J. Paul Schmidt, MBA<BR>Databases on the Web<BR>http://www.Bullschmidt.com<BR>

  4. #4
    Join Date
    Dec 1969

    Default RE: Drop the Dot

    It should have been FOLDER.FILE where FOLDER = the AS/400 Folder and FILE = The File in that Folder...my bad. This works every other time, Why would it not work here?

Posting Permissions

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