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.
Author |
Topic |
WimM
Starting Member
2 Posts |
Posted - 2011-09-05 : 05:01:01
|
I'm getting a CSV file with different record length. Sometimes a record contains all 13 fields of the table, sometimes a record contains e.g. only 6 fields.When not all fields are included, it are always the first fields that are deliverd. So when a record contains only 6 fields, they are the first 6 fields.One way of importing the file is to:1- import the file into a table with only 1 column (say char(large number))2- select the first record 3- search for delimiter and put field into variable4- do so for alll fields (that are in the record)5- update the appropriate table6- select next record7- and so onAre there any other possibilities?English is not my natural language, please excuse me for my mistake THIA,Wim |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-05 : 05:36:10
|
why not use a simple data flow task with excel source and table destination. if it doesnt have any values coming for field it will put nulls so far as they come towards end without any intermediate gaps------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
WimM
Starting Member
2 Posts |
Posted - 2011-09-05 : 07:05:46
|
Can this be done automatic (that is: not a manual task)? The job has to be executed on a periodic and frequent base the next years. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-05 : 08:18:14
|
yep..you can create a sql agent job to call created package and schedule it convieniently------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|