NTBuddy

A place to learn about Microsoft SharePoint and Microsoft Dynamics CRM

DataTypes

 

    Data Types

     

    Family

    Data type

    Range (Low)

    Range (High)

    Storage Size

    Integer

    bigint

    -2^63 (-9,223,372,036,854,775,808)

    2^63-1 (9,223,372,036,854,775,807)

    8 Bytes

    Integer

    int

    -2^31 (-2,147,483,648)

    2^31-1 (2,147,483,647)

    4 Bytes

    Integer

    smallint

    -2^15 (-32,768)

    2^15-1 (32,767)

    2 Bytes

    Integer

    tinyint

    0

    255

    1 Byte

    Monetary

    money

    -922,337,203,685,477.5808

    922,337,203,685,477.5807

    8 Bytes

    Monetary

    smallmoney

    -214,748.3648

    214,748.3647

    4 Bytes

    Date/Time

    datetime

    1/1/1753

    12/31/9999

    8 Bytes

    Date/Time

    smalldatetime

    1/1/1900

    12/31/2079

    4 Bytes

    Special

    bit

    0

    1

    1 Byte

    Special

    timestamp

     

     

    8 Bytes

    Special

    uniqueidentifier

     

     

    16 Bytes

    Approximate Numeric

    float

     

     

    4 Bytes

    Approximate Numeric

    real

     

     

     

    Exact Numeric

    decimal

     

     

     

    Exact Numeric

    numeric

     

     

     

    Binary

    binary

     

     

     

    Binary

    varbinary

     

     

     

    Character

    char

     

     

    Size

    Character

    nchar

     

     

    Size * 2

    Character

    varchar

     

     

    Size

    Character

    nvarchar

     

     

    Size * 2

    Text and Image

    text

     

     

    <= 2,147,483,647

    Text and Image

    ntext

     

     

    <= 2,147,483,647

    Text and Image

    Image

     

     

    <= 2,147,483,647

     

    Date Conversion

     

    Number

    Format

    100 *

    mon dd yyyy hh:miAM

    101

    mm/dd/yyyy

    102

    yyyy.mm.dd

    103

    dd/mm/yyyy

    104

    dd.mm.yyyy

    105

    dd-mm-yyyy

    106

    dd mon yyyy

    107

    mon dd, yyyy

    108

    hh:mm:ss

    109 *

    mon dd yyyy hh:mi:ss:mmmAM

    110

    mm-dd-yyyy

    111

    yyyy/mm/dd

    112

    yyyymmdd

    113 *

    dd mon yyyy hh:mm:ss:mmmm (24h)

    114

    hh:mi:ss:mmm (24h)

     

  1. 2-digit year unavailable
  2.  

    Date Parts

     

    Date Part

    TSQL Abbreviation

    VBScript Abbreviation

    Lower Bound

    Upper Bound

    Year

    yy

    yyyy

    1753

    9999

    Quarter

    qq

    q

    1

    4

    Month

    mm

    m

    1

    12

    Day of Year

    dy

    y

    1

    366

    Day

    dd

    d

    1

    31

    Week

    wk

    ww

    1

    53

    Weekday

    dw

    w

    1 (Sunday)

    7 (Saturday)

    Hour

    hh

    h

    0

    23

    Minute

    mi

    n

    0

    59

    Second

    ss

    s

    0

    59

    Millisecond

    ms

    -

    0

    9999

     

    datetime_new

    dateadd(datepart, number, datetime)

    number_diff

    Datediff(datepart, FromDateTime, ToDateTime)

    string_name

    Datename(datepart, datetime)

    Number_value

    Datepart(datepart, datetime)

Posted: Jun 05 2007, 04:15 PM by NTBuddy | with no comments
Filed under: