data types in sql server

Upload: srikanth-vuduta

Post on 20-Feb-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/24/2019 Data Types in SQL Server

    1/3

    Data Types in SQL SERVER:

    Data Type means the type of data which users provided to a specific columnIn SQL Server 2 types of data types available which includes

    1. System Defined Data Types2. User Defined Data Types.

    System Defined Data Types:

    SQL Server already contains some data types called System Defined data types

    or Predefined Data types or Builtin Data types! System Defined Data Types a"ain

    cate"ori#ed into $ types

    a. Numeric Data types

    b. String Data types

    c. Date Time Data types

    d. Specia Data types

    Numeric Data types:

    These Data types are used to provide numeric information for the columns% these

    includes

    Data Type Si!e

    BIT & or 'TI()I(T ' B)T*

    S+,LLI(T 2 B)T*S - I(T $B)T*SBI.I(T /B)T*S

    0*,L $B)T*S

    1L,T /B)T*SD*3I+,L 4P% S5 6'7 B)T*S

    TI()I(T% S+,LLI(T% I(T% BI.I(T are called E"act Numericswhere as 0*,L%

    1L,T are called #ppr$"imate Numerics!

  • 7/24/2019 Data Types in SQL Server

    2/3

    String Data types:

    These Data types are used to provide character information for the columns% theseincludes

    Data Type Si#e

    38,0 94(5 'B)T*

    - ;,038,0 94(5 'B)T* T*ed len"th data type% which occupies by default ' byte memory!

    ?hen we ( value then it occupies ( bytes of memory where ( is an inte"er! It follows

    Static memory allocation process!

    ;,038,0 94(5: It is a variable len"th data type% which occupies by default ' byte

    memory! ?hen we ( value then it occupies ( bytes of memory where ( is an inte"er! Itfollows dynamic memory allocation process!

    (ote : The +a>imum limit for ( is /&&&%if it is more than /&&& characters we will use

    T*

  • 7/24/2019 Data Types in SQL Server

    3/3

    '! %inary Data types: These stores binary values of a "iven strin" in ordered to hide

    the ori"inal strin" values!

    Data Type Si#e

    BI(,0) 94(5 'B)T* - ;,0BI(,0) 94(5 'B)T*

    2! Unic$de Data types: These Data types are used to store nicode information%these includes

    Data Type Si#e

    (38,0 94(5 2B)T*

    - (;,038,0 94(5 2B)T*

    (T*