how to get default date

  • i have created two parameters  from_date n to_date,in from date what i want is the starting date of current month should display as default date n in to_date last date of current month.

    so what will be the date expression for this query..? 

     

  • from_date=year(getdate())+'-'+month(getdate())+'-'+'1'

    OR

    SELECT from_date=DATEADD(d,-(DAY(GETDATE())-1),GETDATE())

    to_date=DATEADD(d,-DAY(GETDATE()),DATEADD(m,1,GETDATE()))

  • hi..

    thanks for ur reply.

    but it is not working..

    i m using sql server 2005 reporting services and there is no getdate function in it.. so i want the expression for retriving last day of current month.

  • Ajay gave you the TSQL that you can use in a separate dataset which you then use in specifying the default/s for your time parameters.

    If you don't want to use a seperate dataset, you can write the expressions in the parameters dialog yourself, just look up Date functions on msdn online and filter to only VB.net.

    Steve.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply