Results 1 to 11 of 11

Thread: SQL looking in another file?

  1. #1
    I can't get no sleep
    Join Date
    Jul 2003
    Location
    123 Fake Street, London
    Posts
    811
    Thanks
    35
    Thanked
    3 times in 3 posts

    SQL looking in another file?

    Hello,

    I am not sure if this is possible. Can an SQL script look into a text file and use what it finds in there? What is in the text file can be arrange/formatted in any way, even as SQL.

    For example, I would have:
    Code:
    SELECT
     t.*
    FROM
     Some_table t
    WHERE
     t.key_feild IN (look_in_the_text_file)
    This is because the data that is looked for is changed by another process.

    Thanks.
    "Keyboard missing - press F3 to continue" Message seen on an Apricot PC.
    "To start press any key. Where's the any key?" Homer Simpson.
    Hexus Trust

  2. #2
    Agent of the System ikonia's Avatar
    Join Date
    May 2004
    Location
    South West UK (Bath)
    Posts
    3,736
    Thanks
    39
    Thanked
    75 times in 56 posts
    you can do this within a shell eg: set the paramters in the shell then pass then into the sql. Not sure you can do this direct in SQL
    It is Inevitable.....


  3. #3
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    582
    Thanks
    14
    Thanked
    28 times in 22 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    SQL cant but most SQL extension languages can.

    Whats the Database you are trying to use?

    GK
    Keeper of the Gates of Hell

  4. #4
    I can't get no sleep
    Join Date
    Jul 2003
    Location
    123 Fake Street, London
    Posts
    811
    Thanks
    35
    Thanked
    3 times in 3 posts
    Ah right thanks.

    The database is not my creation and is Access.

    The process that outputs the data that needs to be checked is a VB Macro which I did write. Perhaps I could use the macro to edit the script within the database itself?
    "Keyboard missing - press F3 to continue" Message seen on an Apricot PC.
    "To start press any key. Where's the any key?" Homer Simpson.
    Hexus Trust

  5. #5
    Goat Boy
    Join Date
    Jul 2003
    Location
    Alexandra Park, London
    Posts
    2,428
    Thanks
    0
    Thanked
    0 times in 0 posts
    Best way to accomplish this would be to write a macro.
    "All our beliefs are being challenged now, and rightfully so, they're stupid." - Bill Hicks

  6. #6
    I can't get no sleep
    Join Date
    Jul 2003
    Location
    123 Fake Street, London
    Posts
    811
    Thanks
    35
    Thanked
    3 times in 3 posts
    Quote Originally Posted by DaBeeeenster
    Best way to accomplish this would be to write a macro.
    That does what though? If it is to edit the script within Access, have you got any pointers on how to do this?
    "Keyboard missing - press F3 to continue" Message seen on an Apricot PC.
    "To start press any key. Where's the any key?" Homer Simpson.
    Hexus Trust

  7. #7
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    582
    Thanks
    14
    Thanked
    28 times in 22 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    Ok, VBA has this fucntionality but we need to know what kind of file you are trying to access?

    Post an example if its a text file.

    Is in the same place every time?

    You realise that if it is a flat text file you can 'import' it with access as a new table and then use SQL on it?

    GK
    Keeper of the Gates of Hell

  8. #8
    I can't get no sleep
    Join Date
    Jul 2003
    Location
    123 Fake Street, London
    Posts
    811
    Thanks
    35
    Thanked
    3 times in 3 posts
    If I can output from the VBA macro to a flat text file, to the same place each time, that will be fine. I can then import that text file manually into Access if I cannot automate it.

    Data is e-mailed as an Excel spreadsheet. My macro selects cells in the spreadsheet based on set conditions and outputs their contents, which are integers. I only need to know the basics of file output. Point me to a good tutorial and I will be most grateful.

    Thanks.
    "Keyboard missing - press F3 to continue" Message seen on an Apricot PC.
    "To start press any key. Where's the any key?" Homer Simpson.
    Hexus Trust

  9. #9
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    582
    Thanks
    14
    Thanked
    28 times in 22 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    The VB help should be enough.

    I know its old fashoned but the commands you need are:
    Open 'File' for input/output/amend/random as #1
    close #1
    Input #
    Write #
    Print #

    write them into the VB code window click on them and press F1.

    GAteKeeper
    Keeper of the Gates of Hell

  10. #10
    I can't get no sleep
    Join Date
    Jul 2003
    Location
    123 Fake Street, London
    Posts
    811
    Thanks
    35
    Thanked
    3 times in 3 posts
    Thanks GateKeeper. I had been playing with these commands without luck. I had not specified a drive and directory to save the file in previously. Who knows where that output was going.

    Is there any difference between print and write? Print seems to add a space before the output.
    "Keyboard missing - press F3 to continue" Message seen on an Apricot PC.
    "To start press any key. Where's the any key?" Homer Simpson.
    Hexus Trust

  11. #11
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    582
    Thanks
    14
    Thanked
    28 times in 22 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    Not really sure.

    You can specify a full path but if you want (as part of the filename in the open command)

    GAteKeeper
    Keeper of the Gates of Hell

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 63
    Last Post: 14-11-2011, 09:17 AM
  2. How do you backup?
    By Howard in forum PC Hardware and Components
    Replies: 48
    Last Post: 05-01-2005, 09:05 AM
  3. Graphics file format jpeg & WinXP paint...
    By retroborg in forum Graphics Cards
    Replies: 2
    Last Post: 21-07-2004, 09:26 PM
  4. Manage downloaded webpages file and folder
    By Zathras in forum Software
    Replies: 0
    Last Post: 17-09-2003, 05:37 PM
  5. Replies: 0
    Last Post: 20-08-2003, 11:42 AM

Posting Permissions

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