Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Exclamation Unanswered: Variables in sql select statement

    Can you use a variable for the table name in a select statement?

    The following code is working on the server but testing it on my server I get the error:
    “(0x80040E14) Syntax error in query. Incomplete query clause.”

    The variable “sTBL” is the table name. Am I writing bad code or could it just be that the variable “sTBL” is empty until runtime?

    The Code:

    sSQL = "SELECT AT_DIN, AT_TransID, AT_Amount FROM "& sTBL &" WHERE AT_DIN = '" & sDIN & "'"

  2. #2
    Join Date
    Sep 2002
    Provided Answers: 1

    Re: Variables in sql select statement

    Use reponse.write or whatever to write out the value of sSQL before you run it.

Posting Permissions

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