TAILIEUCHUNG - Microsoft SQL Server 2000 Programming by Example phần 2

Mỗi phòng Mặc dù đã được thực hiện trong việc chuẩn bị của cuốn sách này, các nhà xuất bản và tác giả cho là không có trách nhiệm cho các lỗi hoặc thiếu sót. Cũng không phải là bất kỳ trách nhiệm đối với 'thiệt hại DO giả định từ việc sử dụng thông tin Có chứa ở đây. Thư viện Quốc hội Số Danh mục | Microsoft SQL Server 2000 Programming by Example 0 UTPUT The command s completed successfully. The UNIQUEIDENTIFIER data type has an associated system function NEWID that generates new values for these data types. Therefore if you use the UNIQUEIDENTIFIER data type in a table you can use the NEWID system function as the column s default value as Listing shows. Listing Using the NEWID System Function EXAMPLE USE Northwind CREATE TABLE Bigidentifiers col1 UNIQUEIDENTIFIER DEFAULT NEWID GO 0 UTPUT The command s completed successfully. The new SQL_VARIANT data type can store up to 8 016 bytes of almost any base data type. Listing shows how to use the SQL_VARIANr with character and integer data. Listing Using the SQL_VARIANT Data Type EXAMPLE USE Northwind DECLARE @integer_data SQL_VARIANT @char_data SQL_VARIANT 56 Chapter 2. Elements of Transact-SQL SET @integer_data 845 SET @char_data This is character data GO OUTPUT The command s completed successfully. The TIMESTAMP data type is not related at all to DATETIME or SMALLDATETIME. Moreover you cannot directly update a TIMESTAMP column because it updates itself when you insert or update a row that contains a TIMESTAMP. Also there can be only one TIMESTAMP column per table. Creating Customized Data Types User-Defined Data Types Users can create their own data types using the data types provided by Transact-SQL as the base types. To create user-defined data types or UdDT use the sp_addtype system stored procedure and to drop them use sp_droptype. The basic syntax of the sp_addtype system stored procedure is sp_addtype uddt_name uddt_base_type nullability For example suppose that you want to create a UDDT to store phone numbers that could be null. You can define this user-defined data type using the CHAR data type as the base type with a length of 12 as shown in Listing . Listing Creating User-Defined Data Types UDDTs EXAMPLE USE Northwind EXEC sp_addtype phone_number CHAR 12 NULL GO OUTPUT 1 .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.