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 |
|
Yellowdog
Starting Member
34 Posts |
Posted - 2009-01-26 : 13:13:53
|
| I am trying to create an ssis package that will import 4 different files into a temp table for later processing and need to find a way to determine what procedure to call for the specific type.All of the files have similar data but different headers so I figured I could just sniff the file to determine the file type and call the correct procedure from there, only problem is I cannot seem to figure out how it is that I can get this done.I am new to sql and don't know all the tricks yet so any help would be appreciated. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-26 : 13:20:55
|
An SSIS package?Use a FOR EACH LOOP to iterate through all files (an option) if you don't know the exact file names. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-26 : 13:38:11
|
It should be possible to add a data flow task to read only one record, the header record for "sniffing" the file.Then depending on the result, execute the correct stored procedure. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Yellowdog
Starting Member
34 Posts |
Posted - 2009-01-26 : 15:26:33
|
| Ok well I am more confused than ever on this. After some time reading about xp_cmdshell and it seems like it is a powerful tool but after running a few commands I cannot seem to get it to just insert a few columns into a temp table. Unfortunately I am not too familiar with building ssis packages and I am having a difficult time wrapping my brain around how I can manage to get this done.When you talk about using a for each loop to itereate through the file can you explain a little bit about how this is done? I see the tool, I am just unsure how this process works. Is it as simple as adding a directory and a file type and using an insert statement to get just a limited amount of data into the temp table?Thanks again for all the help on this |
 |
|
|
|
|
|