zoukankan      html  css  js  c++  java
  • SQL NULL

    select CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name= 'Alliance'

    select CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name= 'Alliance' and CHARACTER_MAXIMUM_LENGTH is not null;

    select CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name= 'Alliance' and CHARACTER_MAXIMUM_LENGTH is null;

    当遇到Case(字段)..when..then..when.. then..else...end

     select case ISNULL(Cast(CHARACTER_MAXIMUM_LENGTH as varchar(10)),'')
           when '' then ''
           else '('+Cast(CHARACTER_MAXIMUM_LENGTH as varchar(10))+')' end as DATA  
           from information_schema.columns 
    where table_name= 'Alliance'

    一定要用ISNULL转化过来,不能用when NULL 

     或者使用

    case when field is null then...else..end

    select case  
     when CHARACTER_MAXIMUM_LENGTH is null then ''
     else '('+Cast(CHARACTER_MAXIMUM_LENGTH as varchar(10))+')' end as DATA  
      from information_schema.columns 
    where table_name= 'Alliance'
  • 相关阅读:
    串行与并行
    并发性和并行性
    循环移位操作
    关于指针
    各种编程语言的特点
    什么是面向过程,什么是面向对象?
    数组指针/指针数组的示例
    数组指针/指针数组
    操作系统判断
    springMVC---简介
  • 原文地址:https://www.cnblogs.com/hongdada/p/3446112.html
Copyright © 2011-2022 走看看