SlideServe
Menu
Préférences
© SlideServe · v2026

Data Types

zazu avatar
9 diapositives · 499 Views · Aug 22, 2014

Data Types. Integer Int Smallint Tinyint Bit Packed Decimal Decimal(p,s) Floating Point Float Real Character Char(n) Varchar(n). Unicode Nchar(n) Nvarchar(n) Ntext Monetary Money Smallmoney Date and time Datetime Smalldatetime. Built In Data Types. Exotic Data Types.

Data Types - slide 1
01 / 9Data Types
1 / 17

Télécharger la présentation

Data Types
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Data Types

  2. Integer Int Smallint Tinyint Bit Packed Decimal Decimal(p,s) Floating Point Float Real Character Char(n) Varchar(n) Unicode Nchar(n) Nvarchar(n) Ntext Monetary Money Smallmoney Date and time Datetime Smalldatetime Built In Data Types

  3. Exotic Data Types • Binary • Binary(n) • Varbinary(n) • Long text/BLOB • Text • Image • Numerics • Cursor • Timestamp • uniqueidentifier

  4. User-defined Data Type (UDT) • A user-defined data type provides a convenient way to guarantee consistent use of the underlying native data types for columns known to have the same domain of possible values. • For example, you want all phone numbers stored in the database the same way.

  5. UDT example Exec sp_addtype phone_number, ‘char(10)’, ‘not null’ Go to query analyzer and and define this datatype

  6. Sp_addtype • A system stored procedure that creates catalog entries for UDT’s • Syntax sp_addtype [ @typename = ] type,    [ @phystype = ]system_data_type    [ , [ @nulltype = ] 'null_type' ]     [ , [ @owner = ] 'owner_name' ]

  7. Using UDTs in a table • Create the following UDTs • Ssn char(11) not null • Birthdate datetime null • Use those datatypes to create this table • Empl • Name varchar(20) not null • SocNbr ssn • Bdate birthdate

  8. Testing UDTs • Write and insert statement to put data into the new table

  9. Limitations of UDTs • No defaults • No check constraint • No subtyping or inheritance