473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to find how many days in a month by using sql quiery

anybody can tell me how to find how many days in a month by using sql
quiery
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 20 '05 #1
2 3621
Try This

select *, DaysInMonth([MyDate]) from MyTable;
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"project" <bi********@rediffmail-dot-com.no-spam.invalid> wrote in message
news:40********@Usenet.com...
anybody can tell me how to find how many days in a month by using sql
quiery
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 20 '05 #2
http://www.sqljunkies.com/HowTo/6676...C7FD826E5.scuk

Create Function
udf_getNoOfDaysInMonth
(
@month int
,@year int
)
returns
int
as
begin
return datepart( dd,dateadd(dd,-1,(dateadd(mm,@month,dateadd(
yyyy,@year-1900,'19000101')))))
end

go

select dbo.udf_getNoOfDaysInMonth(2,2004)

go

"project" <bi********@rediffmail-dot-com.no-spam.invalid> wrote in message
news:40********@Usenet.com...
anybody can tell me how to find how many days in a month by using sql
quiery
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: chennakeshava_ramesh | last post by:
hi, I have a problem, I am not able to find out which day of the week it is using the calendar class. I am using set() function to set the date and want to find out which day i.e mon,tue etc of...
9
by: Patrick Fisher | last post by:
Hi All If I Take DateFrom from DateTo in a 31 day month I get 30 days because 31-1=30, is there a way of getting the correct answer without having to us a lookup table? Patrick
5
by: Ali Baba | last post by:
Hi, Is there is equivalent of VB's DateDiff() method in C#. I need to find difference in months between two dates that are years apart. Docs says that I can use TimeSpan like: TimeSpam ts =...
19
by: Ricardo Perez Lopez | last post by:
Hello everyone: I'm a PostgreSQL newbie, working now with dates, times, timestamps and intervals. I have three questions about the above: FIRST: --------
3
by: ri58776 | last post by:
Hi, does anyone have any idea how can we get last date of the month in SQL reportging. I am using following fomula, but it works only for 31 days of month, not for feb,april,june...(30 days) ...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
HI I have a stored procedure that returns data with a date field in the form of a DateTime type. I need to place data in variables based on days of the week starting with the first thursday of the...
4
by: cjohns | last post by:
I am brand new to programing and am trying to write a C++ program that calculates how many days are left to a persons birthday. I need to make a function for the leap years, and to get number of...
7
by: Mike | last post by:
I have a routine that's calculating business days but its not counting the weekend days that are between the start date and end date. If my start date is 9/26/08 and my end date is 10/01/08, I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.