+ Reply to Thread
Results 1 to 3 of 3

Import a large SQL query definition from a text file

  1. #1
    Registered User
    Join Date
    08-22-2016
    Location
    MTL, CA
    MS-Off Ver
    2013
    Posts
    60

    Import a large SQL query definition from a text file

    The query definition has about 75 lines. It is part of an Excel VBA routine in which I connect to a MS SQL database using ADO. One reason to go with an external file is to avoid adding the line break characters such as " & _ at the end of every line.

    I am able to retrieve my file with VBA and pass it to string variable, no problem. When I paste it in Microsoft SQL Studio, it will trigger errors. My query definition becomes 4 very long lines of 2000 characters and it will truncate anywhere like a middle of a word.

    Also just a note to mention that when I retrieve the file, by code I replace a variable with an actual part number. For example, 'SC1' can become '0270'

    Obviously I am doing it wrong. Can somebody guide me in the right direction or offer an example. TIA.

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Import a large SQL query definition from a text file

    You probably have to show your code at least, and maybe the SQL too, at least a few complete statements to know what you're actually doing.
    多么想要告诉你 我好喜欢你

  3. #3
    Registered User
    Join Date
    08-22-2016
    Location
    MTL, CA
    MS-Off Ver
    2013
    Posts
    60

    Re: Import a large SQL query definition from a text file

    Ok, I guess that I just had to learn about stored procedures and how to start them with VBA.* *Done.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Web Query Requesting Import Text File Upon Refresh
    By lekiw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2016, 07:15 PM
  2. Replies: 19
    Last Post: 07-20-2014, 04:55 PM
  3. import a large text file into excel
    By Excel_12345 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-03-2013, 04:11 PM
  4. [SOLVED] Need to import a large text file
    By adam23262 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-17-2012, 03:48 PM
  5. Import text file via Query
    By extrapulp in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-15-2011, 09:43 PM
  6. Import Certain Lines from a Large Text File
    By blueperfume300 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-07-2007, 09:07 AM
  7. [SOLVED] Import large text file
    By L. A. M. in forum Excel General
    Replies: 6
    Last Post: 06-01-2005, 05:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1