SSRS 表达式 - Space Between Dates in Check Printing

SSRS Expression - Space Between Dates in Cheque Printing

我的日期字段 Fields!DateStr.Value 给出的日期为 12 March 2015

我对此进行了转换,以便我可以用它来打印一张支票,该支票对日期的每个数字都有不同的方块或方块。

我的表情是——

=Format(CDate(Fields!DateStr.Value),"dd")+" "+Format(CDate(Fields!DateStr.Value),"MM")+"    "+Format(CDate(Fields!DateStr.Value),"yy")

哪个 returns:

12 03 15

但它仍然不适合检查块

我想要什么return

1  2  0  3  1  5

任何人都可以帮助我想到这一点我已经尝试过 split & trim 但他们现在正在为我工​​作。

谢谢

检查此代码:


在 SSRS 中:

=Left(Format(CDate(Today()),"dd"),1)+" "+Right(Format(CDate(Today()),"dd"),1)+" "+Left(Format(CDate(Today()),"MM"),1)+" "+Right(Format(CDate(Today()),"MM"),1)+" "+Left(Format(CDate(Today()),"yy"),1)+" "+Right(Format(CDate(Today()),"yy"),1)

Today()替换成你的字段Fields!DateStr.Value


在SQL中:

declare @Date varchar(10)=  REPLACE(Convert(varchar,getdate(),105),'-','')

DECLARE @postition INT, @result VARCHAR(100); 
   
   SET @result = REPLACE(Convert(varchar,getdate(),105),'-','')
   SET @postition = 2 -- location where we want first space 
   WHILE @postition < LEN(@result)+1 
   BEGIN 
       SET @result = STUFF(@result, @postition, 0, SPACE(1)); 
       SET @postition = @postition+2; 
   END 
   Print @result; 

您也可以将上面的 sql 代码用作 sql 函数。