0% found this document useful (0 votes)
5 views

Tipe Data SQL Server

Uploaded by

hafis5768
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Tipe Data SQL Server

Uploaded by

hafis5768
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Matakuliah Basisdata

Tipe Data
Oleh : Ali Sadikin, S.Kom., MSI.
Program Studi : Sistem Informasi, Sistem Komputer dan Teknik Informatika
STIKOM Dinamika Bangsa Jambi
Tipe Data Pada SQL Server
Karakter, Numerik dan Penanggalan
Tipe Data Karakter
Data Type Syntax Maximum Size Explanation
Where size is the number of characters to store.
CHAR(size) Maximum size of 8,000 characters. Fixed-length. Space padded on right to equal size
characters. Non-Unicode data.
Where size is the number of characters to store.
VARCHAR(size) or VARCHAR(max) Maximum size of 8,000 or max characters. Variable-length. If max is specified, the maximum
number of characters is 2GB. Non-Unicode data.
TEXT Maximum size of 2GB. Variable-length. Non-Unicode data.

NCHAR(size) Maximum size of 4,000 characters. Fixed-length. Unicode data.


Where size is the number of characters to store.
NVARCHAR(size) or NVARCHAR(max) Maximum size of 4,000 or max characters. Variable-length. If max is specified, the maximum
number of characters is 2GB. Unicode data.
NTEXT Maximum size of 1,073,741,823 bytes. Variable length. Unicode data.
Where size is the number of characters to store.
BINARY(size) Maximum size of 8,000 characters. Fixed-length. Space padded on right to equal size
characters. Binary data.
Where size is the number of characters to store.
VARBINARY(size) or VARBINARY(max) Maximum size of 8,000 or max characters. Variable-length. If max is specified, the maximum
number of characters is 2GB. Non-Binary data.
IMAGE Maximum size of 2GB. Variable length . Binary data
Tipe Data Numerik 1
Data Type Syntax Maximum Size Explanation

BIT Integer that can be 0, 1, or NULL.

TINYINT 0 to 255

SMALLINT -32768 to 32767

INT -2,147,483,648 to 2,147,483,647


-9,223,372,036,854,775,808 to
BIGINT
9,223,372,036,854,775,807
m defaults to 18, if not specified. Where m is the total digits and d is the
DECIMAL(m,d)
d defaults to 0, if not specified. number of digits after the decimal.

Where m is the total digits and d is the


m defaults to 18, if not specified.
number of digits after the decimal.
DEC(m,d) d defaults to 0, if not specified.
This is a synonym for the DECIMAL
datatype.
Where m is the total digits and d is the
NUMERIC(m,d) m defaults to 18, if not specified.
number of digits after the decimal.
Tipe Data Numerik 2
Data Type Syntax Maximum Size Explanation
This is a synonym for the DECIMAL
datatype.
Floating point number. Where n is the number of number of bits
FLOAT(n)
n defaults to 53, if not specified. to store in scientific notation.

REAL Equivalent to FLOAT(24)

SMALLMONEY - 214,748.3648 to 214,748.3647


-922,337,203,685,477.5808 to
MONEY
922,337,203,685,477.5807
Tipe Data Penanggalan
Explanation
Data Type Syntax Maximum Size
(if applicable)
Values range from '0001-01-01' to '9999-12-
DATE Displayed as 'YYYY-MM-DD'
31'.
Date values range from '1753-01-01 00:00:00'
to '9999-12-31 23:59:59'.
DATETIME Displayed as 'YYYY-MM-DD hh:mm:ss[.mmm]'
Time values range from '00:00:00' to
'23:59:59:997'
Date values range from '0001-01-01' to '9999-
12-31'. Displayed as 'YYYY-MM-DD
DATETIME2(fractional seconds precision)
Time values range from '00:00:00' to hh:mm:ss[.fractional seconds]'
'23:59:59:9999999'.
Date values range from '1900-01-01' to '2079-
06-06'.
SMALLDATETIME Displayed as 'YYYY-MM-DD hh:mm:ss'
Time values range from '00:00:00' to
'23:59:59'.
Values range from '00:00:00.0000000' to Displayed as 'YYYY-MM-DD
TIME
'23:59:59.9999999' hh:mm:ss[.nnnnnnn]'
Date values range from '0001-01-01' to '9999-
12-31'.
Time values range from '00:00:00' to Displayed as 'YYYY-MM-DD
DATETIMEOFFSET(fractional seconds precision)
'23:59:59:9999999'. hh:mm:ss[.nnnnnnn]' [{+|-}hh:mm]
Time zone offset range from -14:00 to +14:00.

You might also like