Load Txt Files into database

  • Hi All

    I have a server that produces a text file, with a random file name, i am using SQL 2000, i need to load all the files into tables, i can use DTS, but i dont know how to pick up the file from that remote server folder, and i cant delete the files once its loaded as well, i can change the location of the file, have any one done something like this??, is there any other way to load data??

    Cheers

    Suji

  • you can use xp_cmdshell to issue a DIR command into a table and then interrogate to suit.

    [font="Comic Sans MS"]The GrumpyOldDBA[/font]
    www.grumpyolddba.co.uk
    http://sqlblogcasts.com/blogs/grumpyolddba/

  • copy the file from remote server by using xp_cmdshell.Use DTS to export this file to the table.after loading delete the file

  • Thanks a lot Guys

    this sounds perfect, i will try this

    Cheers

    Suji

  • Another option would be to include an ActiveX task in your DTS and use the FileSystemObject to interrogate the remote directory and do any file moving you require.

  • Or just write a small VB script...

  • you can use bulk insert option & xp_cmdshell which is faster

Viewing 7 posts - 1 through 6 (of 6 total)

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