Results 1 to 7 of 7

Thread: Variable Table Names (remedied)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Posts
    81

    Exclamation Variable Table Names (remedied)

    can anyone show me how to reference tables in an sql query with a variable?

    eg SELECT * FROM varTable

    i dont know the syntax ;p

    thanx
    Last edited by TeaSpoon; Dec 10th, 2003 at 03:39 AM.
    ----------------------------------------
    ÖÖ two hungry cookie monsters

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Variable Table Names (a bit urgent :)

    strSQL = "SELECT * FROM " & varTable & ";"

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Posts
    81

    i try :)

    i tried ...

    rsTemp.Open "DELETE * FROM "InputData";",
    gconnMedAidBrowser, adOpenStatic, adLockOptimistic

    but it no work

    is there another way?
    ----------------------------------------
    ÖÖ two hungry cookie monsters

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: i try :)

    You wrote that wrong:


    VB Code:
    1. rsTemp.Open "DELETE * FROM " & InputData, gconnMedAidBrowser, adOpenStatic, adLockOptimistic

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Posts
    81

    Thumbs up mendhak u genius :)

    i didnt see the SQL statement as one long string...
    i was seeing it as being processed one word at a time....
    thanks for the realization

    btw : cute frog Ö
    ----------------------------------------
    ÖÖ two hungry cookie monsters

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    *blushes* Thx

  7. #7
    Hyperactive Member sw_is_great's Avatar
    Join Date
    Nov 2003
    Posts
    330
    Guys according to standard

    DELETE * FROM tablename --- is not good

    Rather use

    DELETE FROM tablename

    There are some rdbms where the 1st statement even does not run....
    Regards

Posting Permissions

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



Click Here to Expand Forum to Full Width