I have a stored procedure that has a companyId field formatted as follows:
Select CONVERT(VARCHAR(14),c.company_id) as CompanyId from table1
I am creating a flat file in SSIS and the companyid field needs to
be right justified, I.e. ' 123456' and the maximum length of the field should be 14 spaces on the flat file.
In the SSIS Derived Column Transformation Editor i wrote the syntax:
REPLICATE(" ",14 - LEN(TRIM(CompanyId))) in the expression field. I thought that this would give me what i needed but it does not.
Can someone help me with the format.
I am using MS SQL Server 2008