October 13, 2014 at 10:42 am
Hi
I have a text file I want to import into SQL. The file contains around 25 columns all with different sizes and data types. The data in the text file does not have column headings however I do have the whole schema in a separate Excel file. I would like to use a script task to import the data from the text file with all the columns and name them accordingly.
So if my file contained the following data
Column 1 (Length of 5 - numeric) = 12345
Column 2 (Length of 10 - text) = ABCD
Column 3 (Length of 7 - numeric) = 5678
Column 4 (Length of 6 - text) = ijytgf
I would like this data to be imported into a sql table called dbo.ImportedData which would have a structure as follows:
TestField1 int null,
TestField2 varchar(10) null,
TestField3 int null,
TestField4 varchar(6) null,
If I could be pointed in the right direction to write the script for this I'd be very grateful...
BO
October 13, 2014 at 10:53 am
Based on your description, a script task is not what you need for this job.
Have a look here for an example of how to import a fixed width flat file into SQL Server using SSIS.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
October 13, 2014 at 11:18 am
Thanks Phil for responding so quickly...
That's exactly what I'm looking for...
October 13, 2014 at 11:33 am
ByronOne (10/13/2014)
Thanks Phil for responding so quickly...That's exactly what I'm looking for...
And thank you for posting back so positively 🙂
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply