Start a new topic

possible to format a date variable multiple ways in same query?

Hi, can we use a single ${mydate}$ variable but format it differently? It appears that if you try multiple format= strings in one query, DBVis ignores the earlier ones and applies the last format string to all instances of the variable.

In the query below, the error output shows that DBVis tried to apply the last specified format "MM" to all instances of "myotherdate"



    cast('20220801' as date),

    datefromparts(2022, 8, 1),

    {d '2022-08-01'},



    cast('Aug 1, 2022' as varchar(20)),

    cast(${myotherdate||||date||format=[MMM dd, yyyy]}$ as varchar(20)),

    datefromparts(${myotherdate||||date||format=[yyyy]}$, ${myotherdate||||date||format=[MM]}$, 28)

Thank you.

1 Comment


The format[] option can only be used with the pre-defined variables:


Read more in:



Login or Signup to post a comment