Tutorial on using special data-PHP

Source: Internet
Author: User
Tags define local
Use special data. Special Data types refer to data types that are not suitable for other data types. For example, to store the values of yes or no in the customer survey with 1 or 0, you can use the bit special data type to indicate the data types that are not suitable for other data types. For example, if you want to store the "yes" or "no" value in the customer survey with 1 or 0, you can use the bit data type. Microsoft®SQL Server™2000 there are several data types in this category:
Bit
Bit data does not need to be placed in single quotes. It is a digital data similar to the integer and numeric data of SQL Server, but the bit column can only store 0 and 1.
SQL _variant
The SQL _variant data type in SQL Server allows a single column, parameter, or variable to store data values of different data types. Each instance in the SQL _variant column records the data value and metadata that describes the value: the basic data type, maximum size, decimal places, precision, and sorting rules of the value.
The second table in the following example contains a SQL _variant column:
Create table ObjectTable
(ObjectID int
CONSTRAINT PKObjectTable primary key,
ObjectName nvarchar (80 ),
ObjectWeight decimal (10, 3 ),
ObjectColor nvarchar (20)
)
Create table VariablePropertyTable
(ObjectID int REFERENCES ObjectTable (ObjectID ),
PropertyName nvarchar (100 ),
PropertyValue SQL _variant,
CONSTRAINT PKVariablePropertyTable
Primary key (ObjectID, PropertyName)
)
To obtain the metadata information of any specific SQL _variant instance, use the SQL _VARIANT_PROPERTY function.
Table
The table data type is similar to a temporary table, which can be used to store a result set for later processing. This data type can only be used to define local variables of the table type and return values of user-defined functions.
The definitions of a table variable or return value include the column, data type, precision, the number of decimal places in each column, and optional primary key, UNIQUE, and CHECK constraints.
The format of rows stored in table variables or returned values of user-defined functions must be defined when variables are declared or functions are created. Its syntax is based on CREATE
TABLE syntax. For example:
DECLARE @ TableVar TABLE
(Cola int primary key,
Colb char (3 ))
Insert into @ TableVar VALUES (1, 'ABC ')
Insert into @ TableVar VALUES (2, 'Def ')
SELECT * FROM @ TableVar
GO
Returns the table variables and user-defined functions of a table. they can only be used in certain SELECT and INSERT statements, and UPDATE, DELETE, and

Bytes. For example, if you want to store the value of yes or no in the customer survey with 1 or 0, you can use bit...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.