SQL Server、JDBC 和 Java 编程语言数据类型之间的默认映射
SQL Server 类型 |
JDBC 类型 (java.sql.Types) |
Java 语言类型 |
bigint |
BIGINT |
long |
timestamp binary |
BINARY |
byte[] |
bit |
BIT |
boolean |
char |
CHAR |
String |
decimal money smallmoney |
DECIMAL |
java.math.BigDecimal |
float |
DOUBLE |
double |
int |
INTEGER |
int |
image varbinary(max) |
LONGVARBINARY |
byte[] |
varchar(max) text |
LONGVARCHAR |
String |
nchar |
CHAR NCHAR (Java SE 6.0) |
String |
nvarchar |
VARCHAR NVARCHAR (Java SE 6.0) |
String |
nvarchar(max) ntext |
LONGVARCHAR LONGNVARCHAR (Java SE 6.0) |
String |
numeric |
NUMERIC |
java.math.BigDecimal |
real |
REAL |
float |
smallint |
SMALLINT |
short |
datetime smalldatetime |
TIMESTAMP |
java.sql.Timestamp |
varbinary udt |
VARBINARY |
byte[] |
varchar |
VARCHAR |
String |
tinyint |
TINYINT |
short |
uniqueidentifier |
CHAR |
String |
xml |
LONGVARCHAR SQLXML (Java SE 6.0) |
String SQLXML |
time |
TIME (1) |
java.sql.Time (1) |
date |
DATE |
java.sql.Date |
datetime2 |
TIMESTAMP |
java.sql.Timestamp |
datetimeoffset (2) |
microsoft.sql.Types.DATETIMEOFFSET |
microsoft.sql.DateTimeOffset |
Oracle和Java数据类型对应关系表
Mysql数据类型与java类型对应关系
Sql Server 数据类型与 C# 数据类型对照表
数据库 |
C#程序 |
int |
int32 |
text |
string |
bigint |
int64 |
binary |
System.Byte[] |
bit |
Boolean |
char |
string |
datetime |
System.DateTime |
decimal |
System.Decimal |
float |
System.Double |
image |
System.Byte[] |
money |
System.Decimal |
nchar |
String |
ntext |
String |
numeric |
System.Decimal |
nvarchar |
String |
real |
System.Single |
smalldatetime |
System.DateTime |
smallint |
Int16 |
smallmoney |
System.Decimal |
timestamp |
System.DateTime |
tinyint |
System.Byte |
varbinary |
System.Byte[] |
varchar |
String |
Variant |
Object |
unique identifier |
System.Guid |
MySQL 数据类型与 C# 数据类型对照表
C# |
MySQL |
|||
类型 |
库类型 |
GetFieldType(#) |
转换 |
备注 |
bool |
BOOL NOT NULL |
Boolean |
|
|
bool? |
BOOL NULL |
Boolean |
|
|
sbyte |
TINYINT NOT NULL |
SByte |
sbyte_ |
|
sbyte? |
TINYINT NULL |
SByte |
sbyte_ |
|
byte |
TINYINT UNSIGNED NOT NULL |
Byte |
|
|
byte? |
TINYINT UNSIGNED NULL |
Byte |
|
|
short |
SMALLINT NOT NULL |
Int16 |
|
|
short? |
SMALLINT NULL |
Int16 |
|
|
ushort |
SMALLINT UNSIGNED NOT NULL |
UInt16 |
ushort_ |
|
ushort? |
SMALLINT UNSIGNED NULL |
UInt16 |
ushort_ |
|
int |
INT NOT NULL |
Int32 |
|
|
int? |
INT NULL |
Int32 |
|
|
uint |
INT UNSIGNED NOT NULL |
UInt32 |
uint_ |
|
uint? |
INT UNSIGNED NULL |
UInt32 |
uint_ |
|
long |
BIGINT NOT NULL |
Int64 |
|
|
long? |
BIGINT NULL |
Int64 |
|
|
ulong |
BIGINT UNSIGNED NOT NULL |
UInt64 |
ulong_ |
|
ulong? |
BIGINT UNSIGNED NULL |
UInt64 |
ulong_ |
|
float |
FLOAT NOT NULL |
Single |
|
极值溢出 |
float? |
FLOAT NULL |
Single |
|
极值溢出 |
double |
DOUBLE NOT NULL |
Double |
|
|
double? |
DOUBLE NULL |
Double |
|
|
decimal |
DECIMAL NOT NULL |
Decimal |
|
极值溢出 |
decimal? |
DECIMAL NULL |
Decimal |
|
极值溢出 |
char |
CHARACTER NOT NULL |
String |
|
中文报错 |
char? |
CHARACTER NULL |
String |
|
中文报错 |
string |
VARCHAR(50) NOT NULL |
String |
|
|
string |
VARCHAR(50) NULL |
String |
|
|
DateTime |
DATETIME NOT NULL |
DateTime |
|
|
DateTime? |
DATETIME NULL |
DateTime |
|
|
Oracle 数据类型与 C# 数据类型对照表
C# |
Oracle |
|||
类型 |
库类型 |
GetFieldType(#) |
转换 |
备注 |
bool |
CHAR(1) NOT NULL |
String |
bool_string |
|
bool? |
CHAR(1) |
String |
bool_string |
|
sbyte |
NUMBER(3) NOT NULL |
Int16 |
sbyte_short |
|
sbyte? |
NUMBER(3) |
Int16 |
sbyte_short |
|
byte |
NUMBER(3) NOT NULL |
Int16 |
byte_short |
|
byte? |
NUMBER(3) |
Int16 |
byte_short |
|
short |
NUMBER(5) NOT NULL |
Int32 |
short_int |
|
short? |
NUMBER(5) |
Int32 |
short_int |
|
ushort |
NUMBER(5) NOT NULL |
Int32 |
ushort_int |
|
ushort? |
NUMBER(5) |
Int32 |
ushort_int |
|
int |
NUMBER(10) NOT NULL |
Int64 |
int_long |
|
int? |
NUMBER(10) |
Int64 |
int_long |
|
uint |
NUMBER(10) NOT NULL |
Int64 |
uint_long |
|
uint? |
NUMBER(10) |
Int64 |
uint_long |
|
long |
NUMBER(19) NOT NULL |
Decimal |
long_decimal |
|
long? |
NUMBER(19) |
Decimal |
long_decimal |
|
ulong |
NUMBER(19) NOT NULL |
Decimal |
ulong_decimal |
|
ulong? |
NUMBER(19) |
Decimal |
ulong_decimal |
|
float |
BINARY_FLOAT NOT NULL |
Single |
|
|
float? |
BINARY_FLOAT |
Single |
|
|
double |
BINARY_DOUBLE NOT NULL |
Double |
|
极值溢出 |
double? |
BINARY_DOUBLE |
Double |
|
极值溢出 |
decimal |
DECIMAL(33,3) NOT NULL |
Decimal |
|
|
decimal? |
DECIMAL(33,3) |
Decimal |
|
|
char |
CHAR(1) NOT NULL |
String |
|
|
char? |
CHAR(1) |
String |
|
|
string |
VARCHAR(50) NOT NULL |
String |
|
不允许空字符 |
string |
VARCHAR(50) |
String |
|
不允许空字符 |
DateTime |
TIMESTAMP NOT NULL |
DateTime |
|
大值读取报错 |
DateTime? |
TIMESTAMP |
DateTime |
|
大值读取报错 |
原文地址:https://www.cnblogs.com/XuYiHe/p/12093214.html
时间: 2024-10-22 06:28:57