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的性能主要取决于磁盘I/O效率,提高I/O效率某种程序上就意味着提高性能。SQL Server 2008提供了数据压缩功能来提高磁盘I/O。
数据压缩意味着减小数据的有磁盘占用量,所以数据压缩可以用在表,聚集索引,非聚集索引,视图索引或是分区表,分区索引上。
数据压缩可以在两个级别上实现:行级别和页级别。页级别压 ......
DateDiff
DateDiff: SQL server函数
返回 Variant (Long) 的值,表示两个指定日期间的时间间隔数目。
语法
DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])
DateDiff 函数语法中有下列命名参数:
部分 描述
interval 必要。字符串表达式,表示用来计算date1 ......
熟练使用SQL Server中的各种用法会给查询带来很多方便。今天就介绍一下EXCEPT和INTERSECT。注意此语法仅在SQL Server 2005及以上版本支持。
EXCEPT是指在第一个集合中存在,但是不存在于第二个集合中的数据。
INTERSECT是指在两个集合中都存在的数据。
测试如下:
create table t1(id int,mark char(2))
go
create ta ......
SQL Server 索引结构及其使用(一)
作者:freedk
一、深入浅出理解索引结构
实际上,您可以把索引理解为一种特殊的目录。微软的SQL SERVER提供了两种索引:聚集索引(clustered index,也称聚类索引、簇集索引)和非聚集索引(nonclustered index,也称非聚类索引、非簇集索引)。下面,我们举例来说明一下聚集索 ......
今天刚开通这个小博,作为庆祝,把我以前空间中的一篇文章转过来。
希望对
问题:由于安装sql server 2000 sp4以后修改了服务器的名称导致SQL中保留的服务器名不正确。
解决方法:
1.select @@servername
查看返回值是否与现在机器名不一致(如果一致就是别的问题了)
2.exec sp_helpserver
查看应该有NAME与network ......