SQL Server 資料型別與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 |