use of com.developmentontheedge.sql.model.AstNumericConstant in project be5 by DevelopmentOnTheEdge.
the class SqlServerTransformer method transformDateTrunc.
@Override
protected void transformDateTrunc(AstFunNode node) {
AstStringConstant child = (AstStringConstant) node.child(0);
String dateformat = child.getValueUnescaped();
AstIdentifierConstant datepart = new AstIdentifierConstant(dateformat);
AstNumericConstant date = AstNumericConstant.of(0);
node.replaceWith(DATEADD.node(datepart, DATEDIFF.node(datepart, date, node.child(1)), date));
}
Aggregations