Datatypes

The following table describes the SQL-DMO abstract datatypes and includes the Hungarian notation prefixes used in the SQL-DMO documentation:

SQL-DMO Datatype
Prefix

Description

String str A generic string. For example, "Felis catus".
MultiString mstr A list of one or more strings delimited by semicolons. For example, "Korat; Maine Coon; Russian Blue".
Identifier id A string that must conform to the rules for Transact-SQL identifiers. For example "pubs".
MultiIdentifier mid A list of one or more identifiers delimited by semicolons. For example, "authors; titles; pub_info".
Long l A 4-byte integer.
Integer i A 2-byte integer.
Boolean b A True/False value. It can be True or False in Visual Basic. It can be TRUE or FALSE in C++.
Float f A 4-byte floating point number. For example, 4.24.
Double d An 8-byte floating point number. For example, 9.39.
Date dat In Visual Basic, an 8-byte Date value.

In C++, a 4-byte integer that has the form YYYYMMDD, where YYYY is the year, MM is the number of the month, and DD is the number of the day. For example, March 22, 1995 is 19950322.


SQL-DMO also uses enumerated datatypes. Each enumeration has a datatype of SQLOLE_INFORMATION_TYPE, and contains a series of SQLOLEInfo_Value constants. The Hungarian notation prefix t is used for enumerated datatypes.

Visual Basic

The following table shows the Visual Basic datatype for each SQL-DMO abstract datatype:

SQL-DMO Datatype Visual Basic Datatype

String String
MultiString String
Identifier String
MultiIdentifier String
Long Long
Integer Integer
Boolean Boolean
Float Single
Double Double
Date Date

C++

Because all SQL-DMO functions return an HRESULT, you must pass the address of a program variable (using the address of & operator) for any return parameter (such as a GetProperty function) so SQL-DMO can write to your program variable. This is the pointer datatype. For an input parameter (such as a SetProperty function), SQL-DMO only reads the program variable. This is the constant datatype.

The following table shows the C++ pointer datatype and constant datatype for each SQL-DMO abstract datatype:

SQL-DMO Datatype
C++ Pointer Datatype

C++ Constant Datatype

String SQLOLE_LPBSTR SQLOLE_LPCSTR
MultiString SQLOLE_LPBSTR SQLOLE_LPCSTR
Identifier SQLOLE_LPBSTR SQLOLE_LPCSTR
MultiIdentifier SQLOLE_LPBSTR SQLOLE_LPCSTR
Long LPLONG long
Integer LPINT int
Boolean LPBOOL BOOL
Float LPFLOAT float
Double LPDOUBLE double
Date LPLONG long