PDF SQL Server and VB Data Types - Home - Springer

SQL Server and VB Data Types

There are some subtle differences in the SQL Server data types versus the Visual Basic data types. This table provides a side-by-side comparison of these data types:

SQL Data Type Bit Tinylnt Money DateTime Decimal

Float

SmallInt Int Real Char and Varchar Text

Range lor 0

oto 255

-922,337,203,685,477.5808 to 922,337,203,685,477.5807 11111753 to 12/3119999 -10"38-1 to 10"38-1

-1.79E + 308 to 1.79E + 308

-32,768 to 32,767 -2,147,483,648 to 2,147,483,647 -3.40E+38 to 3.40E+38 Up to 8,000 characters Up to 2,147,483,647 characters

VB Data Type Boolean Byte Currency Date Decimal

Double

Integer Long Single String String

Range

True/False

o to 255

-922,337,203,685,477.5808 to 922,337,203,685,477.5807 1111100 to 12/3119999

+/79,228,162,514,264,337,593,54 3,950,335 with no decimal +/7.922816251426433759354395 0335 with 28 places to the right of the decimal 4.94065645841247E-324 to 1.79769313486232E308 for positive values

-32,768 to 32,767 -2,147,483,648 to 2,147,483,647

1.401298E-45 to 3.402823E38 for positive values

oto 2,147,483,647

o to 2,147,483,647

Appendix A

The following table lists, by type, all Transact-SQL data types:

SQL Data Type Integers Biglnt lnt SmallInt Tinylnt

Range

-9223372036854775808 to 9223372036854775807 -2,147,483,648 to 2,147,483,647 -32,768 to 32,767

oto 255

Bit

Bit

lor 0

Decimal and Numeric Decimal Numeric

-10"38-1 to 10"38-1 Synonym for decimal

Money Money SmallMoney

-922,337,203,685,477.5808 to 922,337,203,685,477.5807 -214,748.3648 to 214,748.3647

Approximate Numerics Float Real

-1.79E+308 to 1.79E+308 -3.40E+38 to 3.40E+38

Date and Time DateTime SmallDateTime

January 1,1753 to December 31, 9999 January 1, 1900 to June 6, 2079

Character Strings Char VarChar Text

Fixed length character up to 8,000 characters Variable length character up to 8,000 characters Variable length character up to 2,147,483,647 characters

752

SQL Data Type Unicode Character Strings nChar nVarChar nText

Binary Strings Binary VarBinary Image

Other Cursor RowVersion

Table UniqueIdentifier

Range

SQL Server and VB Data Types

Fixed length data up to 4,000 characters Variable length data up to 4,000 characters Variable length data up to 1,073,741,823 characters

Fixed length binary data up to 8,000 bytes Variable length binary data up to 8,000 bytes Variable length binary data up to 2,147,483,647 bytes

Reference to a cursor Database-wide unique number (formerly known as a Timestamp) Stores values of various SQL Server-supported data types, except Text, nText, Timestamp Special data type used to store a result set for later processing Global unique identifier

753

ADO 2.6 Object Model

This appendix lists the objects, methods, and properties of the Microsoft ActiveX Data Objects library version 2.6.

Objects

Name Command

Connection Error

Errors

Field Fields Parameter

Parameters Property

Properties

Description

A Command object defines a specific command that you intend to execute against a data source.

A Connection object represents an open connection to a data source.

An Error object contains details about a single data access error pertaining to a single operation involving the provider. The provider is the driver used to access the database such as SQLOLEDB.

A collection of all the Error objects created in response to a single failure involving the provider.

A Field object represents a column of data.

A collection of all the Field objects of a Recordset or Record object.

A Parameter object represents a parameter or argument associated with a Command object based on a parameterized query or stored procedure.

Contains all the Parameter objects of a Command object.

A Property object represents a characteristic of an ADO object that is defined by the provider.

A collection of all the Property objects for a specific instance of an object.

Table continued on following page

Appendix B

Name Record Recordset

Stream

Description

The Record object represents a row in a recordset, or a file or directory in a file system.

A Recordset object represents the entire set of records from a base table or the results of an executed command. At any time, the Recordset object refers to only a single record within the set as the current record.

A Stream object represents a stream of binary data or text.

Command Object

A Command object is a definition of a specific command that you intend to execute against a data source.

Methods

Name Cancel

Create Parameter

Execute

Returns

Parameter object Recordset object reference

Description

Cancels execution of a pending, asynchronous Execute or Open method call.

Creates a new Parameter object with the specified properties.

Executes the query, SQL statement, or stored procedure specified in the CommandText property.

Properties

Name ActiveConnection

CommandText CommandTimeout

CommandType CommandStream

Returns Variant

String Long

CommandTypeEnum Stream

Description

Indicates to which Connection object the specified Command, Recordset, or Record object currently belongs.

Contains the text of a command that you want to issue against a provider.

Indicates how long to wait while executing a command before terminating the attempt and generating an error.

Indicates the type of a Command object.

Indicates the stream used as the input for a Command object.

756

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download