bcp_gettypename
Returns the SQL type name for a specified BCP type token.
Syntax
RETCODE bcp_gettypename (
INT token,
DBBOOL fIsMaxType);
Arguments
token
A value indicating a BCP type token.field
Indicates if token requested is a max type.
Returns
A string containing the SQL type name corresponding to the BCP type. If an invalid BCP type is specified, an empty string is returned..
Remarks
The BCP type tokens are defined in the sqlncli.h header file and the sqlncli11.lib library.
The table below specifies the possible BCP types, whether or not they are max types, and the expected output.
BCP type name |
MaxType |
Output |
---|---|---|
SQLDECIMAL |
Either |
decimal |
SQLNUMERIC |
Either |
numeric |
SQLINT1 |
Either |
tinyint |
SQLINT2 |
Either |
smallint |
SQLINT4 |
Either |
int |
SQLMONEY |
Either |
money |
SQLFLT8 |
Either |
float |
SQLDATETIME |
Either |
datetime |
SQLBITN |
Either |
bit-null |
SQLBIT |
Either |
bit |
SQLBIGCHAR |
No |
char |
SQLCHARACTER |
No |
char |
SQLBIGVARCHAR |
No |
varchar |
SQLVARCHAR |
No |
varchar |
SQLTEXT |
Either |
text |
SQLBIGBINARY |
No |
binary |
SQLBINARY |
No |
Binary |
SQLBIGVARBINARY |
No |
Varbinary |
SQLVARBINARY |
No |
Varbinary |
SQLIMAGE |
Either |
Image |
SQLINTN |
Either |
int-null |
SQLDATETIMN |
Either |
datetime-null |
SQLMONEYN |
Either |
money-null |
SQLFLTN |
Either |
float-null |
SQLAOPSUM |
Either |
Sum |
SQLAOPAVG |
Either |
Avg |
SQLAOPCNT |
Either |
Count |
SQLAOPMIN |
Either |
Min |
SQLAOPMAX |
Either |
Max |
SQLDATETIM4 |
Either |
smalldatetime |
SQLMONEY4 |
Either |
Smallmoney |
SQLFLT4 |
Either |
Real |
SQLUNIQUEID |
Either |
uniqueidentifier |
SQLNCHAR |
No |
Nchar |
SQLNVARCHAR |
No |
Nvarchar |
SQLNTEXT |
Either |
Ntext |
SQLVARIANT |
Either |
sql_variant |
SQLINT8 |
Either |
Bigint |
SQLCHARACTER |
Yes |
varchar(max) |
SQLBIGCHAR |
Yes |
varchar(max) |
SQLBIGVARCHAR |
Yes |
varchar(max) |
SQLVARCHAR |
Yes |
varchar(max) |
SQLBINARY |
Yes |
varbinary(max) |
SQLBIGBINARY |
Yes |
varbinary(max) |
SQLBIGVARBINARY |
Yes |
varbinary(max) |
SQLVARBINARY |
Yes |
varbinary(max) |
SQLNCHAR |
Yes |
nvarchar(max) |
SQLNVARCHAR |
Yes |
nvarchar(max) |
SQLXML |
Yes |
Xml |
SQLUDT |
Either |
Udt |
bcp_gettypename Support for Enhanced Date and Time Features
The token parameter values for date/time types are described in the "Type in sqlncli.h" column of the table in Bulk Copy Changes for Enhanced Date/Time Types (OLE DB and ODBC). The returned value is in the corresponding row of the "File storage type" column.
For more information, see Date/Time Improvements (ODBC).