.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

first date of previous month?

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :Sql Server
How to get the first date of previous month?
PS.Shakeer Hussain Hyderabad

View Complete Post

More Related Resource Links

Crawler fails to register date properties of user profiles with the month of January, April, August


This seems to be a bug when the crawler search the user profiles in MOSS 2007.  When crawled, user profiles with a SPS-HireDate in the months of January, April, August and December will be detected, but a full-text (SQL) search returns those profiles without the HireDate field.

User profiles with HireDates in other months work correctly, returning the HireDate in the search.  And changing the month of a problematic user profile also fixes the problem.

This problem is also reflected in the fact that while we have 499 user profiles using the SPS-HireDate property,  the managed property page from the search section only has 350 items with the HireDate property.

We're running MOSS 2007 32bit with SP2 with an English language base and the Spanish language pack. I'd considered date format problems, but I can't imagine how some months would work, while others wouldn't.

Any ideas?

How to create a calcuated member, which will always return the date one month before the currentmemb

I need to create a calculated member in the cube script, which will be subsequently used in various other script calculations.  It needs to return the date, which is 1 month before the currentmember of the Date dimension. I tried something like this: CREATE MEMBER CURRENTCUBE.[Measures].[LastPD]   AS           PARALLELPERIOD([Date].[Calendar].[Month], 1, [Date].[Calendar].currentMember) ,VISIBLE = 1; However when I then try to check the values with this query: SELECT [Measures].[LastPD] on 0, [Date].[Calendar].[Date].members on 1 FROM [TravCSAT] ; I only get NULLs for [LastPD].  Any idea what I am doing wrong?

Date format for Year, Year-Month, and Date (Year-Month-Day) where input is not known

I have a requirement to capture historical events in a table. Now some events will have only Year, some Year/Month, and remaining where Date is known. We should be able to store them in the column and be able to sort etc. When publishing the information, we should be able to publish as was the input, Year only, Year-Month only, or Date. I looked at the newer Date data type. I can insert a 4 digit year, but on retrieving it is YYYY-01-01. I do not know if it has input YYYY or YYYY-MM-DD and is indeed a Date or a Year. I am trying to avoid saving the format information in another column or something. For sorting, when records have same Year, I would have another column to do relative sorting... So question is - what are my best options with SQL/Entity Framework combo. And what others have done, when encountering similar - if any. Thanks in advance. --Sharad 

Retrieve month name and last 2 digit of yr from date column

Table contain one column [d_matur] [datetime] NULL 2014-06-20 00:00:00.000 2015-03-20 00:00:00.000 like this now I want to retrieve month name like June as well as last two digit of year like 14 if anyone know query how to get these from above column please let me know.Thanks

How to Correlate Last weekday of previous Month and First Weekday of current Month ? - T-SQL 2005

Hi friends, below is my detail description. I woulld like to show busines users Previous Months Last Weekday in Drop Down List as a Parameter. Now, if they select Previous Months Last Weekday, then i need to pass First weekday of Current month. How can i correlate this things ? if you need more information, let me know.   Thanks.

Previous working date - Time dimensions


Hi all,

I need an mdx to get the previous working day. 

I`ve got my complete time dimension, including weekends.  Every day member has got a Member Property that says wether it is a working day or not.  See table below.  Then, I need an mdx expression to return the "Prev working Day".  Any idea??



day of the month IsWorkingDay Prev Working Day
01/09/2010      1

Send a reminder email 1 month before renewal date




I have a custom list with information about our customers and when we need to renew there equipment. When we add entries to the list we have field called Renewal date where we select the date the equipment needs renewing.


I would like to create a workflow so I can select the entry click on workflows and set the entry to email me 1 month before the renewal is due.


I am using SBS 2008 and WSS 3.0


Thanks in advance

MDX find last (flagged) day of previous month


I need to find last working day of previous month in Calendar hierarchy for a given date - any help on this? The last day of every month is indicated by MonthEnd flag that is related to Date attribute. I need to get figures for this date in MDX query.

My Calendar dimension has Calendar hierarchy that has year, month, date levels. Also, there is a MonthEnd attribute related to date that is either yes/no.

Thanks. Pl note I cant use SSAS stored proc .


I have a solution but seems to be complex.

select {
		{NULL:ClosingPeriod ([Calendar].[Calendar].[Date], 
	).Item(0).Item(0) ,

	[Calendar].[Calendar].[Date].&[20100925]} on 0


Query acting weird.. larger date range works in 1min 26sec and a smaller range say 1 month - 3 month


I have no clue why my query is acting weird

If i try to run it for 1/1/2010 9/30/2010 the query takes around 1min 26 sec and  return around a million rows

and If i run for 8/1/2010 to 8/31/2010 it takes forever to it...

basically i am getting data from 5 tables and putting it in a temp table and then updating that temp table 2-3 times with some information and then displaying it.

I am stumped as to why it works fast for a longer date range and runs the  snail for a small period of time..

I am in the verge of pulling my hair and going crazy..

any help will be appreciated.




check if date in last month

How can i check if the date is in last month

Ignore date and consider month and year to match


Hi there,

It is required to retrieve the records where ONLY Start Month, Year AND End Month, Year are passed. Trying below SQL to get these with no success. 

registrationdate BETWEEN(MONTH((registrationdate) = 01) AND (Year(registrationdate)= 2009)) AND ((Month(registrationdate) =03) AND (Year(registrationdate)=2010))


Help is appreciated.

need of Ascending order based on the Date and month.


Hi friends,

query.Append("SELECT Name, Sex, Marital_Status, Dob, Anniversary, Mobile, Email FROM Client WHERE ");

            if (startDate > new DateTime() && endDate > new DateTime())
                query.Append("(DATEADD(YEAR,DATEDIFF(YEAR, DOB,'" + startDate + "'),DOB) BETWEEN '" + startDate + "'AND'" + endDate + "' OR DATEADD(YEAR,DATEDIFF(YEAR, ANNIVERSARY,'" + startDate + "'),ANNIVERSARY) BETWEEN '" + startDate + "'AND'" + endDate + "') AND ");
           if (!string.IsNullOrEmpty(maritalStatus) && !string.Equals("All", maritalStatus))
                query.Append(" Marital_Status = '" + maritalStatus + "'");

            string resultQuery = query.ToString();
            if (resultQuery.Trim().EndsWith("AND", StringComparison.OrdinalIgnoreCase))
                int lastIndex = resultQuery.LastIndexOf("AND");
                resultQuery = resultQuery.Remove(lastIndex, 3);

            if (resultQuery.Trim().EndsWith("WHERE"))
                int lastIndex = resultQuery.LastIndexOf("WHER

asp JScript date of the month


I was wondering if there was a asp JScript function that will tell me what week of the month it today is. 
I mean F Oct 8 2010 = 2 week of the month  and S Oct 10 2010 = 3rd week of the month 

I was wondering if there was a asp JScript function that will tell me what week of the month it today is. 

I mean F Oct 8 2010 = 2 week of the month  and S Oct 10 2010 = 3rd week of the month 


How to remove weekend days from current row date and Previous row date ?


column0    Column1                     ResultColumn

1              Mon, 07/12/2002           0 days

2              fri, 11/12/2002              4 days

3              mon, 14/12/2002           1 days

Thanks & Regards, PSWASULE

Need Help - Grouping multiple fields to get top 10 for month then using that data to get previous mo



I’m querying a database in BIDS using SQL 2005 to produce a report in SSRS. All the information I need is in one table.

The table has 3 columns. The data within each column can be identical but when the 3 columns are grouped together they make up a unique set.

For example:
Month     Col 1     Col2       Col3
201009   Field A   Field B   Field C
201009   Field A   Field B   Field D

201009   Field A   Field B   Field D

201009   Field A   Field E   Field C
201009   Field B   Field B   Field F

201009   Field B   Field B   Field F
201009   Field B   Field G   Field G
201009   Field C   Field B   Field F

I need to count the number of times these unique sets appear each month and produce a report showing the to

Month To date caluclation MDX..Please help


I am a very new bie to SSAS/MDX. I am developing a report on existing  ssas cube. My report shud be sme thing like this

                  Todays date       M2D





A,B,C are measures in my cube . So I want to create caluclated members for sum(A),sum(B),Sum(C) between startday of month and today.So that I can drag caluclated members into my report. I have trsansaction date as dimension. Please help me in regarding . Looks simple but not getting enough hands on doing this.

Thanks in advance. Awaiting for the reply.



sql query for month and year of date

I have a table with smallint columns for day,month,year. Now I want to select data lets say for month 10,year 2009 to month 2,year 2010. Can anyone help me in writing this query?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend