Home >Backend Development >PHP Tutorial >Using special data_PHP tutorial

Using special data_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:01:01778browse

Special data types are those data types that do not fit into the classification of other data types. For example, to store a "yes" or "no" value in a customer survey as 1 or 0, respectively, you would use the bit data type. Microsoft® SQL Server™ 2000 has several data types in this category:
bit
bit data does not have to be placed in single quotes. It is numeric data similar to SQL Server's integer and numeric data, 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 of a sql_variant column records a data value and metadata that describes the value: the value's base data type, maximum size, scale, precision, and collation.
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 metadata information for any specific sql_variant instance, use the SQL_VARIANT_PROPERTY function.
table
table data type is similar to a temporary table that can be used to store a result set for later processing. This data type can only be used to define local variables of table type and return values ​​of user-defined functions.
The definition of a table variable or return value includes columns, data type, precision, number of decimal places for each column, and optional PRIMARY KEY, UNIQUE, and CHECK constraints.
The format of rows stored in table variables or in user-defined function return values ​​must be defined when the variable is declared or the function is created. Its syntax is based on the syntax of CREATE
TABLE. 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
Returning a table table variables and user-defined functions can only be used for certain SELECT and INSERT statements, and among them UPDATE, DELETE and

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631178.htmlTechArticleSpecial data types refer to those data types that do not fit into the classification of other data types. For example, to store a yes or no value in a customer survey as 1 or 0 accordingly, you would use bit...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn