DataSource Controls :: Group By Month - Format Like MM YY
Feb 13, 2010
i have to Count Data Month wise and Date format would be like this Feb-10 and iam using the below query but no luck .
SELECT REPLACE(CONVERT(CHAR(9), ADate, 6), ' ', '-') As 'MonthYear', COUNT(AID) AS 'Planned' FROM Employee where Status =1 and YEAR(Adate) = '2009' GROUP BY YEAR(Adate), MONTH(Adate) ORDER BY YEAR(Adate),MONTH(Adate)
I have a objectdatasource control with a field of date and time and I was wanting to know how you format the date to uk format with the select statement through my objectdatasource. And what type of integer is bigint in SQL?
I need to return a string in the format YYYYMM but I am not able to figure out how to get the month in the format MM (02 for Feb). This is what I did
Create FUNCTION [dbo].[GetMonth](@Today DateTime) RETURNS nvarchar AS BEGIN Declare @mth nvarchar; Set @mth = cast(month(@Today) As nvarchar); IF month(@Today) < 10 Begin Set @mth = '0' + cast(month(@Today) As nvarchar) End Return @mth; END
This is returning a 0. I don't know what is wrong in the IF block.
DateTime ExpMonth = Convert.ToInt32(ddExpMonth); ---- DropDown(user selects a month) DateTime ExpYear = Convert.ToInt32(ddExpYear); ---- Dropdown(user selects year) Datetime ExpDate = ///// I want this part to be saved as Datetime 02/2012
I want to know that how can i sum All values from same months to a single month. Like all Jan. values should be summed as 'Jan' and all feb. values should be summed as 'Feb'. I am using below query to only get the current year's values
in visual web developer 2008 in "Query" Can I format the date to display only Month and year ?example: I have Complete date in my table like 05/04/2010. In Query in need to display only Month and year Like 04/2010 Or April/2010
Assuming I enter into TextBox txtReleaseDate a date in format month/day/year, then upon clicking an Update or Insert button, a CompareValidator control complains that date format is not valid. But if I enter date in format day/month/year, then object data source throws an exception Cannot convert value of parameter 'releaseDate' from 'System.String' to 'System.DateTime', while CompareValidator doesn't complain. I need the two controls to accept the same date format, so:
a) Since my DB stores date in format day/month/year, the best option would be for ODS to also accept this as valid date format. Can ODS be configured that way?
b)Can CompareValidator be configured to also accept month/day/year format?
i have a event page that displays all upcoming birthdays,
if birthday is today--it will display today,if tomorrow it will display tomorrow..i for other month birthdays i want to display month name also..my code is like this
if (bthday == DateTime.Today.Date.ToShortDateString()) { lblDate.Text = "Today"; }
[Code]....
AS you see it will display days name. i want it should display month name also
I am developing membership for website. SQL Server 2005 is at backend. I want Column <Package> to "Free" from "Premium" automatically when month ends. The website is membership per month basis. Two type of members "Free" and "Premium".
Is there any way to automatically column update as month ends. Can I do it with triggers? If yes then how?
Set @StartMonth = Aug Set @EndMonth = Jan Set @StartYear = 2009 Set @EndYear = 2010
I need to insert records into one new table based on the above informations Month name should go from StartMonth to EndMonth and Year also should insert like below
MonthName Year Aug 2009 Sep 2009 Oct 2009 Nov 2009 Dec 2009 Jan 2010
2) when I pass again
Set @StartMonth = Dec Set @EndMonth = Feb Set @StartYear = 2009 Set @EndYear = 2010
It should check for the records already in the database and should not insert the duplicate record. Based on the above case it should insert only one record
MonthName Year Feb 2010
3) I need to also calculate number of days in the month except sat and sunday ..
Like Jan2010 we have 21 days except Saturday and Sunday
Is there any logic through which we calculate the number of days.?
SELECT documentcategoryname, documentname, documentid FROM documents INNER JOIN documentcategory ON documents.documentcat = documentcategory.documentcategoryid WHERE documentsiteid = @siteid GROUP BY documentcategoryname, documentname, documentid
Which gives the following results:
documentcategoryname | documentname | documentid About Us doccy3 3 About Us doccy4 4 Map Of Medicine doccy5 5
Is there a way using vb.net I can just display the category name once, and the documents underneath it like below:
About Us doccy3 doccy4 Map Of MEdicine doccy5
My code so far is:
If pagesreader.Read() Then ' output documentcategoryname mydata &= "<h2>" & reader.Item("documentcategoryname") & "</h2>" 'display document list here using while loop? End if
I've written this code to display a group of events when the value is 12/19/2010. This means each day I need to change the "default value" to the current date to display the events of the day. I would like to make this such that the change occurs automatically, that is, on 12/20/2010, I'd like to see just the events for 12/20/2010.
I'm trying to create a menu structure, subpages within pages, for use with my cms. I have 3 tables in sql server, I would like to query all three tables and list those pages with a certain siteid, and subpages where the subid is the pageid. how to use the GROUP BY Statement to create the menu below? Or could I use vb.net to display it for me? Something like this:
SELECT * FROM sites LEFT JOIN pages ON sites.siteid=pages.siteid LEFT JOIN subpages ON pages.pageid=subpages.pageid WHERE sites.siteID = 1ORDER BY sites.siteid, pages.pagesub ASC
These are my tables:
sites siteID int Unchecked PK siteName nvarchar(MAX) Checked siteAdmin nvarchar(MAX) Checked siteLive bit Checked Pages
pageID int Unchecked PK siteID int Checked FK linked to siteid in sites table pageLink nvarchar(MAX) Checked pageBody ntext Checked pageSummary ntext Checked pageTitle ntext Checked pageOrder int Checked pageHome bit Checked
subpages
subID int Unchecked PK PageID int Checked FK linked to pageid in pages table subBody ntext Checked subSummary ntext Checked subTitle nvarchar(MAX) Checked subOrder nvarchar(MAX) Checked
I'm attempting to further reduce a dataset/table by various user input. Part of this process is grouping the data by a timestamp prior to a summation. I'm trying to use LINQ and cannot get the data returned that I need.