Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 File handling/importing

Author  Topic 

Alexh89
Starting Member

6 Posts

Posted - 2012-02-28 : 04:53:30
Hello,

I would like to ask you for advise. I have a server with several files, ranging from 1 to over a hundred.
The files are .txt files, in which the columns are seperated by either a ~ or a tab. All files need to be read, edited (substrings to select columns and creating specific keys) and stored in SQL server 2008. This needs to be done with timed jobs/stored procedures. What is the best way to do this? Include an .exe in the job, T-SQL or something different? As i'm new to this subject, could you also provide a simple (code) example? Thank you in advance.

Alex

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2012-02-28 : 05:06:33
You can use bcp or bulk-insert to bulk-load the text file to a load table. You can then use stored procs to massage the data in the load table as per your requirements and push the final result to destination table.

Harsh Athalye
http://www.letsgeek.net/
Go to Top of Page
   

- Advertisement -