Showing posts with label flat. Show all posts
Showing posts with label flat. Show all posts

Wednesday, March 21, 2012

Name Flat file at run time

Hi,

I create a flat file in my package using Dataflow task and then I need to send that text file on some FTP site but the problem I am facing is I need to generate file name at run time like file name should be like "abc.yymmdd.txt" where yymmdd are Year,month and date.

Is there any way to give name to a flat file?

Thanks,

Pooja

your Connection Manager has a Property Collection called Expressions. Expand that, and set the ConnectionString to a variable expression.|||

"ABC." + (DT_WSTR,8) ( (YEAR(@.[User:Big SmileateTimeVar]) * 10000) + (MONTH(@.[User:Big SmileateTimeVar]) * 100) + DAY(@.[User:Big SmileateTimeVar]) ) + ".TXT"

Change the variable reference (@.[User:Big SmileateTimeVar]) to GETDATE() if you want today's date to be used.

sql

n00b: best way to import flat file with BIDS

Hi all,

I'm totally new to SQL Server 2k5 and need to do something rather basic: import some CSV files into tables. I'm getting translation errors and would like to know what's the best way to cast the strings before inserts.

I'm doing the import in BI Development Studio.

Current situation:

Created connection managers to csv files
created SQL server destinations pointing to the tables
connected them directly with a dataflow path
Ran the packadge: one import went just fine, the other one complains about conversion errors like "Conversion DT_STR and DT_I4 not supported"

Both tables have the same kind of fields (varchar, float, datetime, int)

I looked at converting the data using a transformation but am somewhat confused of which one to use.

What's the best way to transform the data before insert: derived column, import column or data conversion? Or something else I overlooked?

TIA

PeterFor doing this kind of work, I prefer to use bcp.exe over SSIS/DTS. It's a simple command line utility.

Look for "bcp utility" in BOL.

Monday, March 19, 2012

Mysteriously dropped rows using Data Flow Task

I'm using the Data Flow Task to load data from a flat file into a SQL table and I'm missing rows. And there doesn't see to be any consistent or obvious reason why.

When I use the Bulk Insert Task I import the correct number of rows from the flat file. But when I use the Data Flow task and use a Flat File Source connected to a OLE DB Destination I get about 1/3 the right number of rows. So looking at these loaded tables at the same time I notice that the Data Flow Task method just skips rows sometimes.

Why does this happen?

Try to enable error output and redirect the error output to a different table and see if any rows are sent there.

Hope this helps,

Ovidiu Burlacu

|||

just for people looking around; this issue got addres in other post: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=884012&SiteID=1

Rafael Salas