Import a .txt file into SQL Server 2008

I want to import a text file in SQL Server 2008. Obviously, the text file is similar to

AA89ATOZ MR 1 PMANUAL >0 1 0 0 0 0 0 0 0 0 0 0 1. 

There are thousands of records in the record. When I download a text file using excel, it will set all the texts in one line. I read some answer that

 AA89ATOZ,MR,1,PMANUAL,>0,1,0,0,0,0,0,0,0,0,0,0,1. 

If I can do something like the above, how can I change it? Does it have a function for splitting text on a line? Please let me know the answer. Thanks.

+4
source share
1 answer

You have several options for inserting data into SQL Server from a text file. Here are a couple that are widely used.

The SQL Server Import and Export Wizard is fairly simple, and the resulting Integration Services package can be saved and scheduled for execution:

http://msdn.microsoft.com/en-us/library/ms141209.aspx

Or you can use the TULL BULK INSERT command. This requires that the text file is either on the file system of the database server or is accessible via the UNC path:

http://msdn.microsoft.com/en-us/library/ms188365.aspx

+2
source

All Articles