Databases Reference
In-Depth Information
Conversion
Function Name
Return Type
Description
(returns a
Converts a value to a specified data type.
CAST()
specified type)
CAST(the
_
value
_
AS
_
the
_
type)
(returns a
Converts (and optionally formats) a value to a specified
CONVERT()
specified type)
data type. Formatting may be applied to numeric and
date types.
CONVERT(the
_
type, the
_
value)
or
CONVERT(the
_
type, the
_
value, format
_
number)
Cursor
Function Name
Return Type
Description
Returns the status of a previously opened cursor.
CURSOR_STATUS() SmallInt
1 = Open and populated, 0 = Contains no records,
-1 = Closed, -2 = No cursor or de-allocated,
-3 = Doesn't exist
Date
Function Name
Return Type
Description
DateTime
or Returns a date value (
DateTime
or
SmallDateTime
)
SmallDateTime
from a date value added by
X
number of date interval
(depending on
DATEADD()
units. Units may be
Year
,
Quarter
,
Month
,
DayOfYear
,
input type)
Day
,
Hour
,
Minute
,
Second
, or
Millisecond
.
Returns an integer representing the difference between
two date values (
DateTime
or
SmallDateTime
) in
specified date interval units. Units may be
Year
,
Quarter
,
Month
,
DayOfYear
,
Day
,
Hour
,
Minute
,
Second
, or
Millisecond
.
DATEDIFF()
Int
Similar to
DATEPART()
. Returns a character string
representing the specified date part for a date value.
The
Datepart
parameter is the same as the
DATEDIFF()
interval and includes
Year
,
Quarter
,
Month
,
DayOfYear
,
Day
,
Hour
,
Minute
,
Second
, or
Millisecond
.
DATENAME()
nVarChar
Similar to
DATENAME()
. Returns an integer representing
the specified date part for a date value. The
Datepart
parameter is the same as the
DATEDIFF()
interval and
includes
Year
,
Quarter
,
Month
,
DayOfYear
,
Day
,
Hour
,
Minute
,
Second
, or
Millisecond
.
Table continued on following page
DATEPART()
Int
Search WWH ::
Custom Search