易截截图软件、单文件、免安装、纯绿色、仅160KB

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数据库定时自动备份

     1、进入企业管理器中->管理->sql server代理->作业;
  2、新建作业,作业名称随便取,例如:data备份,所有者选择sa,当然你也可以选择其他用户,前提是该用户有执行作业的权限;
  3、点击步骤标签,进入步骤面板。新建步骤,步骤名可以随便填写,如步骤1,类型和数据库默认,不 ......

SQL时间比较 dateDiff方法使用

DateDiff
  DateDiff: SQL server函数
  返回 Variant (Long) 的值,表示两个指定日期间的时间间隔数目。
  语法
  DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])
  DateDiff 函数语法中有下列命名参数:
  部分 描述
  interval 必要。字符串表达式,表示用来计算date1 ......

SQL SERVER 2000/2005 列转行 行转列


普通行列转换
问题:假设有张学生成绩表(tb)如下:
姓名 课程 分数
张三 语文 74
张三 数学 83
张三 物理 93
李四 语文 74
李四 数学 84
李四 物理 94
想变成(得到如下结果):
姓名 语文 数学 物理
---- ---- ---- ----
李四 74 84 94
张三 74 83 93
-------------------
*/
create table tb(姓名 varc ......

sql server创建数据库脚本

use master
go
--切换master数据库
if exists(select 1 from sysdatabases where name = N'test')
--注意该同名数据库是否还要用到
begin
drop database test
end
go
create database test
on
primary
( name = 'testprimary', --主数据文件逻辑名
filename = 'D:\testprimary.mdf',--主数据文件存放路径
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号