Friday, February 24, 2012

How to build this expression?

Greetings friends,

I have the following T-SQL CASE statement. I've spent the last 10 minutes trying to convert it to an expression in my derived column component but to no avail.

case
when f.etypeid < 10 then '000' + cast(f.etypeid as varchar)
when f.etypeid > 10 and f.etypeid < 100 then '00' + cast(f.etypeid as varchar)
else
'0' + cast(f.etypeid as varchar)
end

Many thanks for your help in advance.

Hi again guys,

Finally I managed to work it out. Silly me!

The solution to the above is as follows :

etypeid < 10 ? "000" + (dt_str,1,1252)etypeid : etypeid > 10 && etypeid < 100 ? "00" + (dt_str,2,1252)etypeid : "0" + (dt_str,3,1252)etypeid

Sorry for the bother SSIS friends

|||Mark your post as an answer, please.

No comments:

Post a Comment