Hi there,
How to import data from such text files into a specified table?
http://www.geocities.com/salan_alani/outputlog.txt
The data I want to import is only the last 5 lines (for instance) shown in the above text file. So, I want first to ignore the header in the beginning of the file, and the other thing that in my row lines (last 5 lines shown in the text file) there is no specific delimeter but each field has a fixed size and position in the line (for example: "RNC ID" field correspond to the first 8 charactes in the line)
I tried to use BULK INSERT statement but I could not figure out how to ignore the header.
I am using SQL Server 2005 Express Edition
Thanks in advanced,
Salan
You need to specify the FIRSTROW parameter with the number of teh first row to import.|||All the options can be found in BOL
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/be3984e1-5ab3-4226-a539-a9f58e1e01e2.htm
|||Thanks SimonSa,
But please could you show me how the FORMATFILE could be in my case, I just need an example to start over.
Thanks in advanced,
Salan
|||The FIRSTROW parameter is specified as an option to the BULK INSERT statement. You don't have to do anything to the format file itself. You can also pass this parameter to the BCP command-line utility using -F option.
No comments:
Post a Comment