Thursday, May 16, 2013

To pad zeros in left with the numerical value


SELECT EmpID
,REPLICATE('0',11 - LEN(EmpID))+ CAST(EmpID AS varchar ) AS EmpKey
FROM dbo.DimEmployee

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.