Import text file on local machine

  • I need to import some text data as part of a stored procedure that will be executed in Query Analyzer. The data is on a desktop PC. The name of the file changes each day.

    Here's the limitations I have to work with:

    DTS is not an option (unless someone knows how to reverse engineer the data import)

    Placing the text file on the server is not an option

    The file can not be accessed from the server over the network back to the PC

    Since the file is not on the server and can't be placed there:

    BULK INSERT is not an option

    OPENROWSET/OPENDATASOURCE are not options

    Does anyone have an idea how I can import the data?

  • I'd do a quick and dirty .NET app. Let them select the file and click an import button.

  • I would too but the boss said to make it pure TSQL to run in QA.

    The problem is that the import is only 1 step of the process. There's another 14 steps in the process that manipulates the data and puts it into the tables where it needs to go.

    And this is run with 7 different text files 3 times a week.

  • But what the boss doesn't understand and you need to get him or her to understand is that pure T-SQL does not actually run on the client, but on the server. So the server will need access to the file across the network in order for it to be processed by T-SQL.

    A .NET app will be mush simpler for the user as they can click on a icon on their desktop, select the file using file explorer, and click a button. All the steps could be put in the app and you can put a listbox that updates after each step is completed. Or you can have triggers or a SQL Agent job that processes the data once you have it in SQL Server.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply