select DATEDIFF(month, '2001-12-01', '2002-09-30') : DATEDIFF « Date Functions « SQL Server / T-SQL Tutorial

Home
SQL Server / T-SQL Tutorial
1.Query
2.Insert Delete Update
3.Table
4.Table Join
5.Data Types
6.Set Operations
7.Constraints
8.Subquery
9.Aggregate Functions
10.Date Functions
11.Math Functions
12.String Functions
13.Data Convert Functions
14.Analytical Functions
15.Sequence Indentity
16.View
17.Index
18.Cursor
19.Database
20.Transact SQL
21.Procedure Function
22.Trigger
23.Transaction
24.XML
25.System Functions
26.System Settings
27.System Tables Views
28.User Role
29.CLR
SQL Server / T-SQL Tutorial » Date Functions » DATEDIFF 
10.4.4.select DATEDIFF(month, '2001-12-01', '2002-09-30')
2>
3select DATEDIFF(month, '2001-12-01', '2002-09-30')
4> GO

-----------
          9

(rows affected)
10.4.DATEDIFF
10.4.1.Finding the Difference Between Two Dates
10.4.2.DATEDIFF returns the difference between two dates as specified by datepart: DATEDIFF(datepart,date1,date2)
10.4.3.select DATEDIFF(day, '2001-12-01', '2002-09-30')
10.4.4.select DATEDIFF(month, '2001-12-01', '2002-09-30')
10.4.5.select DATEDIFF(year, '2001-12-01', '2002-09-30')
10.4.6.select DATEDIFF(hour, '06:46:45', '11:35:00')
10.4.7.select DATEDIFF(minute, '06:46:45', '11:35:00')
10.4.8.select DATEDIFF(second, '06:46:45', '11:35:00')
10.4.9.select DATEDIFF(quarter, '2001-12-01', '2002-09-30')
10.4.10.select DATEDIFF(week, '2001-12-01', '2002-09-30')
10.4.11.select DATEDIFF(day, '2002-09-30', '2001-12-01')
10.4.12.SELECT DATEDIFF(yy, 'Jan 1, 1998', 'Dec 31, 1998')
10.4.13.SELECT DATEDIFF(yy, 'Dec 31, 1998', 'Jan 1, 1999')
10.4.14.Find difference in months between now and EndDate
10.4.15.A SELECT statement that computes the age of a Billing with DATEDIFF
10.4.16.Days between two dates
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.