The Data Types In Microsoft SQL Server Computer Science Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Binary data consists of hexadecimal numbers for example "245" is a decimal number and "f5" is a hexadecimal. Binary data is stored using the "binary, varbinary, and image" data types in Microsoft® SQL Server. A column assigned the "binary" data type must have the same fixed length for each row. In a column assigned "varbinary" data type, entries can vary in the number of hexadecimal digits they contain. Columns of "image" data can be used to store variable-length binary data, such as Microsoft Word documents, Microsoft Excel spreadsheets, and images that include bitmaps, Graphics Interchange Format (GIF), and Joint Photographic Experts Group (JPEG) files.

Character data consists of any combination of letters, symbols, and numeric characters. For example valid character data includes "928", "Johnson", and "(0*&(%B99nh  jkJ".

In Microsoft® SQL Server, character data is stored using the "char, varchar, and text" data types. "varchar" is used when the entries in a column vary in the number of characters they contain. "char" is used when every entry for a column has the same fixed length. Columns of "text" data can be used to store ASCII characters. For example HTML documents are all ASCII characters and usually longer than 8 KB, they can be stored in text columns in SQL Server prior to being viewed in a browser.To store international character data in SQL Server, the nchar, nvarchar, and ntext data types are used.

Unicode Data

Traditional non-Unicode data types in Microsoft® SQL Server allow the use of characters that are defined by a particular character set. A character set is chosen during SQL Server Setup and cannot be changed. Using Unicode data types, a column can store any character defined by the Unicode Standard, which includes all of the characters defined in the various character sets. Unicode data types take twice as much storage space as non-Unicode data types.

Unicode data is stored using the " nchar, nvarchar, and ntext " data types in SQL Server. "nvarchar" is used when a column's entries vary in the number of Unicode characters they contain. "nchar" is used when every entry for a column has the same fixed length. "ntext" is used when any entry for a column is longer than 4,000 Unicode characters.

Date and Time Data

Date and time data consists of valid date or time combinations. For example, valid date and time data includes both "4/01/98 12:15:00:00:00 PM" and "1:28:29:15:01 AM 8/17/98".

Date and time data is stored using the "datetime and smalldatetime" data types in Microsoft® SQL Server. "datetime" is used to store dates in the range from January 1, 1753 through December 31, 9999. "smalldatetime" is used to store dates in the range from January 1, 1900 through June 6, 2079.

Numeric Data

Numeric data consists of numbers only. Numeric data includes positive and negative numbers, decimal and fractional numbers, and whole numbers (integers).

Integer Data

Integer data consists of negative or positive whole numbers, such as -15, 0, 5, and 2509.

Integer data is stored using the "bigint, int, smallint, and tinyint" data types in Microsoft® SQL Server. "bigint" data type is used to store numbers in the range from -2^63 (-9223372036854775808) through 2^63-1 (9223372036854775807). "int" data type is used to store numbers in the range from -2,147,483,648 through 2,147,483,647 only. "smallint" data type is used to store numbers in the range from -32,768 through 32,767 only and "tinyint" data type is used to store numbers in the range from 0 through 255 only.

Decimal Data

Decimal data consists of data that is stored to the least significant digit. Decimal data is stored using decimal or numeric data types in SQL Server. The number of bytes required to store a decimal or numeric value depends on the total number of digits for the data and the number of decimal digits to the right of the decimal point. For example, more bytes are required to store the value 19283.29383 than to store the value 1.1. In SQL Server, the numeric data type is equivalent to the decimal data type.

Monetary Data

Monetary data represents positive or negative amounts of money. Monetary data is stored using the "money and smallmoney" data types. Monetary data can be stored to an accuracy of four decimal places. "money" data type is used to store values in the range (from -922,337,203,685,477.5808 to +922,337,203,685,477.5807). "smallmoney" data type is used to store values in the range (from -214,748.3648 to 214,748.3647). If a greater number of decimal places are required the decimal data type is used instead.

Special Data

Special data consists of data that does not fit any of the categories of data such as binary data, character data, Unicode data, date and time data, numeric data and monetary data. Microsoft® SQL Server includes four types of special data:

timestamp

Is used to indicate the sequence of SQL Server activity on a row, represented as an increasing number in a binary format. As a row is modified in a table the timestamp is updated with the current database timestamp value obtained. "timestamp" data is not related to the date and time of an insert or change to data. "rowversion" data type is a synonym for "timestamp".

bit

Consists of either a 1 or a 0. Use the bit data type when representing TRUE or FALSE, or YES or NO. For example, a client questionnaire that asks if this is the client's first visit can be stored in a bit column.

uniqueidentifier

Consists of a 16-byte hexadecimal number indicating a globally unique identifier (GUID). The GUID is useful when a row must be unique among many other rows. For example, use the uniqueidentifier data type for a customer identification number column to compile a master company customer list from multiple countries.

sql_variant

A data type that stores values of various SQL Server supported data types (except text, ntext, timestamp, image, and sql_variant).

table

A special data type used to store a result set for later processing. The table data type can be used only to define local variables of type table or the return value of a user-defined function.

user-defined

Allows for a user-defined data type.

Writing Services

Essay Writing
Service

Find out how the very best essay writing service can help you accomplish more and achieve higher marks today.

Assignment Writing Service

From complicated assignments to tricky tasks, our experts can tackle virtually any question thrown at them.

Dissertation Writing Service

A dissertation (also known as a thesis or research project) is probably the most important piece of work for any student! From full dissertations to individual chapters, we’re on hand to support you.

Coursework Writing Service

Our expert qualified writers can help you get your coursework right first time, every time.

Dissertation Proposal Service

The first step to completing a dissertation is to create a proposal that talks about what you wish to do. Our experts can design suitable methodologies - perfect to help you get started with a dissertation.

Report Writing
Service

Reports for any audience. Perfectly structured, professionally written, and tailored to suit your exact requirements.

Essay Skeleton Answer Service

If you’re just looking for some help to get started on an essay, our outline service provides you with a perfect essay plan.

Marking & Proofreading Service

Not sure if your work is hitting the mark? Struggling to get feedback from your lecturer? Our premium marking service was created just for you - get the feedback you deserve now.

Exam Revision
Service

Exams can be one of the most stressful experiences you’ll ever have! Revision is key, and we’re here to help. With custom created revision notes and exam answers, you’ll never feel underprepared again.