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 2008 Forums
 Analysis Server and Reporting Services (2008)
 flat file to oledb

Author  Topic 

PGG_CA
Starting Member

24 Posts

Posted - 2013-06-06 : 11:43:58
I am creating this package that reads a text file and imports the data into a table.

In the table are 12 fields but I am only populating 9 from the text file. These fields are all nullable except for one, which is also populated by the text file data. The other fields are "audit" fields where the app_name(), user_name() and getdate() expressions are used to populate these fields as default constraints.

I am getting a data truncation error when I run the package and I traced it to the fact the appname audit field is set to varchar(30) but SQL Server's default value "Microsoft SQL Server Management Studio - Query" exceeds it. I cannot change the table design so I need to change this value somehow to 30 characters or less. I cannot change the text file either.

I am thinking I should add a column in the flat file source external column, give it the correct value and then map it to the destination column. BUt I don't know how to do this? Or there is a better way of handling this?

Please help. Thanks.

PGG_CA
Starting Member

24 Posts

Posted - 2013-06-06 : 13:34:51
Got it. I added a derived column, added a field adn set its value there, mapped it to the db table field and voila it worked.
Go to Top of Page
   

- Advertisement -