Set maxdate by TSQL statement