zoukankan      html  css  js  c++  java
  • 空值的日期类型和update 中的null

    创建一个表

    create table testdate1(name nvarchar(50),dtime datetime)
    go
    insert into testdate1 values('x11',''),('x12','1900-01-01 00:00:00.000')
    go
    select * from testdate1

    image

    select * from testdate1 
    where dtime=''

    image

    update testdate1 set dtime=null
    where name='x11'
    select * from testdate1
    where dtime is null

    image

    上面的测试,只是要说明两点

    1.datetime类型是空的话,会设置为datetime的初始值;select查询时where条件直接可以=’’。这条很容易理解的

    2.update语句中,null值也使用'=’;以前只知道where条件中的null,必须使用is null(当然SET ANSI_NULLS ON改为OFF就可以用‘=’,一般人不会闲着蛋疼加上这句,我刚刚蛋疼了一把),而不知道更新中可以使用‘=’设置null

  • 相关阅读:
    git 常用操作命令行
    Mysql 命令行...
    bootstrap
    10.11 android输入系统_补充知识_activity_window_decor_view关系
    10.10 android输入系统_APP获得并处理输入事件流程
    10.9 android输入系统_APP跟输入系统建立联系和Dispatcher线程_分发dispatch
    10.8 android输入系统_实战_使用GlobalKey一键启动程序
    10.7 android输入系统_Dispatcher线程情景分析_Reader线程传递事件和dispatch前处理
    10.6 android输入系统_Dispatcher线程_总体框架
    10.5 android输入系统_Reader线程_使用EventHub读取事件和核心类及配置文件_实验_分析
  • 原文地址:https://www.cnblogs.com/cnmarkao/p/3835726.html
Copyright © 2011-2022 走看看