Author |
Topic |
somenoob
Posting Yak Master
112 Posts |
Posted - 2011-09-28 : 23:26:14
|
Hi everyone,in my report parameter in the layout page, how do i get the first day of the previous month (eg august as now is sept), in the 'start' parameter in the default value segment. in the preview tab, the start textbox that i have should display 1/8/2011. and also the last day of the previous month in the 'end' parameter. in the preview tab, the end textbox should display 31/8/2011.thanks |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-28 : 23:41:28
|
you can do likestartdateDATEADD(MONTH,DATEDIFF (MONTH, #1/1/1900#, Now())-1, #1/1/1900#)end dateDATEADD(DAY,-1,DATEADD(MONTH,DATEDIFF (MONTH, #1/1/1900#, Now()), #1/1/1900#))------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
somenoob
Posting Yak Master
112 Posts |
Posted - 2011-09-28 : 23:54:56
|
thanks..i have another problem. select distinct left(convert(varchar,atb,112),6) as year_mth,right(convert(varchar,atb,106),8) as year_mth_labelfrom dbwhere left(convert(varchar,atb,112),6) >= 201101order by year_mth descwhen i have this codes, in the preview tab, it display only dates which there are records in it. i want it to display all the month from 201101 to the current month. how do i do that? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
somenoob
Posting Yak Master
112 Posts |
Posted - 2011-09-29 : 00:09:02
|
in the report parameter how do i write the default values in the non-query so that it displays the 201109 (current month) in the preview tab?-----------is there any other way to do it? like just code it in the dataset?cause i do not have permission to add new things |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-29 : 00:22:06
|
do as earlier suggestion and then use substring to get only year and month partyou can create the udf as given in posted link and then create the query based on it in dataset------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
somenoob
Posting Yak Master
112 Posts |
Posted - 2011-09-29 : 02:04:22
|
if i use the codes in your blog, how do i combine it with my codes? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-29 : 08:09:48
|
what do you mean by combine with your codes? whats your current code?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|