I have a flat file that I am importing into SQL Server 2008 using an SSIS package.
The file contains a field with a number, followed by a column with a negative sign when the preceding column value is negative.
For instance:
Price Sign
----- -----
9212.00
29.01 -
268.00 -
453.02
I want to load this value into a decimal column on a table.
In order to accomplish this, I am creating a derived column in my Data Flow Task. The expression for the derived column is [Sign] + [Price]
. I have (using the Advanced Editor) defined the derived column as type decimal [DT_DECIMAL]
.
Then I'm simply loading the data (along with the derived column) into my table.
Does this sound like a good way to handle this situation? Is there another method that I should consider instead? Any 'gotchas' with using this method?
Thanks.
Derived Column Name Derived Column Expression Data Type ------------------- -------------- ---------- --------- Final_Price [sign]+[price] decimal[DT_DECI
So: Price = 232.43 Sign= - becomes -232.43 and when I load into my database this value goes into the column on the table defined as decimal(10,2) as -232.43. Just want to make sure I understand the benefits of the second approach over the first. Thanks again. – user1949225 Jan 04 '13 at 21:11