Hi There,
I am trying to order my months in calendar format (Jan, Feb, Mar...), but I can not. It only shows in alphabetical order (Apr,Aug,Dec..) .
Does anyone now how I can change the order from alphabetic to calendar order?
Thanks in advance...
2 4350
Hi There,
I am trying to order my months in calendar format (Jan, Feb, Mar...), but I can not. It only shows in alphabetical order (Apr,Aug,Dec..) .
Does anyone now how I can change the order from alphabetic to calendar order?
Thanks in advance...
How are you arriving at your month values? if they derived from a formatting a date field then simply create a view that looks at that date field and expresses it as a month like this
MonthNum: MONTH(NameOfYou rDateField])
This will then give you the numeric 1 - 12 values that you can sort on
So a typical select SQL statement would look something like this in a view (or stored procedure)
SELECT FirstName,Surna me,DateOfBirth, MONTH([DateOfBirth]) as MonthNum FROM dbo.tblMyTable
You then get the extra column useful for sorting your recordset in the manner you need, in your displayed recordset when the view is run
Jim
deepuv04 227
Recognized Expert New Member
Hi There,
I am trying to order my months in calendar format (Jan, Feb, Mar...), but I can not. It only shows in alphabetical order (Apr,Aug,Dec..) .
Does anyone now how I can change the order from alphabetic to calendar order?
Thanks in advance...
try the following example ...
will help you
declare @table table (id int,date datetime)
select DATENAME(month, CONVERT(datetim e,getdate(), 113))
insert into @table values(1,getdat e())
insert into @table values(2,datead d(month,1,getda te()))
insert into @table values(4,datead d(month,2,getda te()))
insert into @table values(3,datead d(month,3,getda te()))
insert into @table values(6,datead d(month,4,getda te()))
insert into @table values(5,datead d(month,5,getda te()))
--select * from @table
select id,convert(varc har(3),datename (month,date)) from @table order by date
thanks
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ken Fine |
last post by:
(originally posted to one of macromedia's groups; no help, so hopefully
someone here can help me out. I'm using VBScript ASP.)
When designing administrative interfaces to websites, we often need to
provide users with a mechanism to change the order of items that are listed
on the page.For example, the _New York Times_ website
(http://www.nytimes.com) lists a bunch of top news articles, and normally
these are ordered by purely mechanical...
|
by: Mike Nolan |
last post by:
I notice that 7.4 doesn't do default ordering on a 'group by', so you have
to throw in an 'order by' clause to get the output in ascending group order.
Is this something that most RDB's have historically done (including PG prior
to 7.4) but isn't really part of the SQL standard?
On a mostly unrelated topic, does the SQL standard indicate whether NULL
should sort to the front or the back? Is there a way to force it to
one or the other...
|
by: Ken Durden |
last post by:
Is there any way to control ordering of items in intellisense via
attributes?
For example, I have the following enum:
public enum ESeverity
{
Acceptable,
Low,
Medium,
|
by: Brian Tkatch |
last post by:
An ORDER BY a simple-integer inside a FUNCTION, results in SQL0440N,
unless the FUNCTION expects an INTEGER as its parameter. For example:
DECLARE GLOBAL TEMPORARY TABLE A(A CHAR(1))
INSERT INTO SESSION.A VALUES ('a'), ('b')
CREATE FUNCTION A(A char(1)) RETURNS char(1) DETERMINISTIC NO EXTERNAL
ACTION RETURN A
SELECT A FROM SESSION.A ORDER BY A(1)
DROP FUNCTION A
DROP TABLE SESSION.A
|
by: Sridhar |
last post by:
Hi,
I need to display a calendar that shows all the months of an year. In
that, I need to show different colors for certain events. I know how to
display a calendar for a certain month but I am not sure if there is a way to
display all the months of an year? Please let me know.
Thanks,
Sridhar.
| |
by: AlanF |
last post by:
This may seem like a trivial question but I have been unable to figure this
out.
In .NET 2003, I'm trying to display 6 months using the MSFT calendar
control. I am displaying the months in a 3x2 configuration. I want the
current month to be the last month displayed (ie top row Dec, Jan, feb,
bottom row march, april, May). I can't seem to set this or force this. The
display is top row Jan, Feb March and the bottom row is April May June. For...
|
by: Garg |
last post by:
Hi
i want to disable soem months in my calendar control.
I dont want to display certain months at all in my calendar. How do i
do that?
Shivani
|
by: Steven W. Orr |
last post by:
I'm reading a logfile with a timestamp at the begging of each line, e.g.,
Mar 29 08:29:00
I want to call datetime.datetim() whose arg2 is a number between 1-12 so I
have to convert the month to an integer.
I wrote this, but I have a sneaky suspicion there's a better way to do it.
mons = {'Jan':1, 'Feb':2, 'Mar':3, 'Apr':4, 'May':5, 'Jun':6,
'Jul':7, 'Aug':8, 'Sep':9, 'Oct':10, 'Nov':11, 'Dec':12 }
|
by: =?Utf-8?B?QUEyZTcyRQ==?= |
last post by:
Why does System.Globalization.DateTimeFormatInfo.CurrentInfo.MonthNames
return 13 elements? Why does it not use the cuurent culture?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |