SQL Server JDBC Deriver Problems
If the SQL data type is 'timestamp', we need to use ResultSet.getBytes() to retrieve its value. If the SQL data type is 'datetime', we can use ResultSet.getTimestamp(). It is said timestamp is interanlly saved as binary data.
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn = DriverManager.getConnection
("jdbc:sqlserver://<url_address>;user=<user>;password=<password>;database=<database>");
Statement statement = conn.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("...");
while (rs.next()) {
System.out.println(rs.getTimestamp(1));
}
} catch (Exception e) {
e.printStackTrace();
}
相关文档:
SQL Server 索引结构及其使用(一)
作者:freedk
一、深入浅出理解索引结构
实际上,您可以把索引理解为一种特殊的目录。微软的SQL SERVER提供了两种索引:聚集索引(clustered index,也称聚类索引、簇集索引)和非聚集索引(nonclustered index,也称非聚类索引、非簇集索引)。下面,我们举例来说明一下聚集索 ......
普通行列转换
问题:假设有张学生成绩表(tb)如下:
姓名 课程 分数
张三 语文 74
张三 数学 83
张三 物理 93
李四 语文 74
李四 数学 84
李四 物理 94
想变成(得到如下结果):
姓名 语文 数学 物理
---- ---- ---- ----
李四 74 84 94
张三 74 83 93
-------------------
*/
create table tb(姓名 varc ......
use test
go
if exists table student is not null
else
drop table student
go
create table database_name.schema_name.table_name
(属性1 字符类型 约束,
属性2 字符类型 约束....
)
go
insert into table_name values ('属性1’,‘属性2’,......)
--插 ......