cmj97

1.sql语句

在insert语句中需要插入查询出来的值。 Insert into a (a1,a2,a3) values (1,select num from b where id=1,3) 这样写就出现了“在此上下文中不允许使用子查询。只允许使用标量表达式。”这个错误

可以这样: insert into a (a1,a2,a3) select 1,num,3 from b where id=1 即可解决问题.

 

2.如何将string类型转化为sql.date(util.date与sql.date不能直接转化)

        if (year != null && month != null && day != null) {            
            String birthday = year + "-" + month + "-" + day;
            SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");  
            java.util.Date d = null;  
            try {  
                d = format.parse(birthday);  
            } catch (Exception e) {  
                e.printStackTrace();  
            }  
            java.sql.Date date = new java.sql.Date(d.getTime());
            user.setuBirthday(date);

 

3.除非另外还指定了 TOP 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。

 

分类:

技术点:

相关文章:

  • 2021-07-30
  • 2021-12-25
  • 2021-08-05
  • 2022-01-14
  • 2021-10-01
  • 2021-11-19
  • 2021-11-19
  • 2021-12-22
猜你喜欢
  • 2021-08-07
  • 2021-08-16
  • 2021-11-13
  • 2021-10-18
  • 2021-05-15
  • 2021-11-18
  • 2021-07-29
相关资源
相似解决方案