Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSIS ( cannot able to change datatype column using datatype conversion...... Expand / Collapse
Author
Message
Posted Wednesday, July 31, 2013 4:42 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, September 18, 2013 7:36 AM
Points: 22, Visits: 43
Hi,
Source: multiple text file
Requirement:
1. Define age columns as small integer.
2. Convert gross column from $ 667 00 to 667.00 and change datatype from string to money.
3. Convert date format from 12122012 to 12/12/2012 and change datatype from string to date data type.
4. Finally load all flat file to a db table in sql server using a single destination.

For which I converted gross column using dervied column transformation and for date column using substring.
Now i can't able to change gross and date columns datatype from string to money and date data type.

Please help me to solve this issue....
Thanks in advance
Post #1479382
Posted Thursday, August 1, 2013 8:30 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, September 4, 2014 5:40 PM
Points: 29, Visits: 129
if you want to do data conversion, like convert string to money, I suggest to use 'Data Conversion' instead of 'Derived Column', it's easier.
Post #1479969
Posted Thursday, August 1, 2013 11:40 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, September 18, 2013 7:36 AM
Points: 22, Visits: 43
Thanks for the reply...
I tried even using data conversion, still its not working... one of my friend suggest me to use temp table convert using query and load it into destination, I don't know how to use that......
Please suggest..........
Post #1480248
Posted Wednesday, August 7, 2013 11:57 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, September 4, 2014 5:40 PM
Points: 29, Visits: 129
for example, convert string '$123456789' to money 1234567.89

1. Use Data Coversion to convert '$123456789' to data type currency[DT_CY], it will be 123456789 in a new output alia after this step.
2. Use Derived Column to change 123456789 to 123456789, just divided by 100. You need to make sure all values have two decimals. it generates a new column.
3. Then you can insert the new column generated in step#2 into money column on destination table.

you can also right click data source (ex. Flat File Source), Show Advanceded Editor -> Input and Output Properties - > Flat File Source Output -> Output Columns, to change the DataTypethe of the column to currency[DT_CY], so that you don't have to use Data Conversion. But I usually use it. It's up to you.

If the value in text file has already has decimal, you don't have to use step #2.
Post #1481995
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse