![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I used to DTS to export data from DB2 to text file with delimited characters instead of fixed width format. In the text file, I notice that the numeric fields were not padded with leading zeros, but I need the leading zeroes. I tried another method by importing from DB2 to a SQL table and when I run query on the table, it doesn't show leading zeroes as well.( In DB2, the data are with leading zeroes) Has anyone got any idea on the above ? thnks. |
#3
| |||
| |||
|
|
In message <254C5E54-6104-4060-9938-1008D5FA3C1D (AT) microsoft (DOT) com>, Jess Jess (AT) discussions (DOT) microsoft.com> writes I used to DTS to export data from DB2 to text file with delimited characters instead of fixed width format. In the text file, I notice that the numeric fields were not padded with leading zeros, but I need the leading zeroes. I tried another method by importing from DB2 to a SQL table and when I run query on the table, it doesn't show leading zeroes as well.( In DB2, the data are with leading zeroes) Has anyone got any idea on the above ? thnks. In DB2 I assume you could write a query that fomatted the data first, or it is definitely possible in T-SQL, e.g. SELETCT RIGHT('0000000000' + CAST(NumericCol AS varchar(10), 10) AS NumericCol) FROM Table Or you could do this formatting in an ActiveX Script Transform, using some VBScript, e.g. DTSDestinatination(1).Value = Right("0000000000" + CStr(DTSSource(1).Value), 10) -- Darren Green (SQL Server MVP) DTS - http://www.sqldts.com PASS - the definitive, global community for SQL Server professionals http://www.sqlpass.org |
![]() |
| Thread Tools | |
| Display Modes | |
| |