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.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Text file connection string manager

Author  Topic 

PatDeV
Posting Yak Master

197 Posts

Posted - 2009-07-22 : 14:01:45
How can i create Text connection string manager!! So i dont' have to do manual text source connection.

filesource: C:\test\daily_data_*.txt

thanks
Pat

rgombina
Constraint Violating Yak Guru

319 Posts

Posted - 2009-07-22 : 14:27:06
You can use Foreach Loop and iterate through the folder and use the path as source (map to a variable).
Go to Top of Page

PatDeV
Posting Yak Master

197 Posts

Posted - 2009-07-22 : 14:31:14
yeah but i need to do the text file source and when i try to do this:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\daily_data_*.txt;Extended Properties="text;HDR=Yes;FMT=Delimited";

it says The file name "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\daily_data_*.txt;Extended Properties="text;HDR=Yes;FMT=Delimited";" specified in the connection was not valid.

where i am missing now?

thanks
Go to Top of Page

PatDeV
Posting Yak Master

197 Posts

Posted - 2009-07-22 : 15:07:49
Also

What is am missing here:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @[User::Fname] + ";Extended Properties="text;HDR=No;FMT=Delimited";"
Go to Top of Page

rgombina
Constraint Violating Yak Guru

319 Posts

Posted - 2009-07-22 : 15:43:07
Are the files the same layout/format?

The connection string you have doesn't need to be contructed that way. Go to properties of your file, on the Connection Manager > Expression, insert @[User::Fname].

You just need to connect a normal file connection to one of your files, format the way you need them be and do the step above.

This works only if you're using the Foreach Loop since the path of the current file position is passed onto the connection string.
Go to Top of Page
   

- Advertisement -