isnull具体怎么用? 跟什么函数用,或者是在什么情况下用?
  请高手具体说说!

解决方案 »

  1.   

    select ISNULL(null,1)           
    -----------
              1(1 行受影响)
      

  2.   


    create table #tt(i int)insert #tt select null
    insert #tt select 2
    select ISNULL(i,1) as  i from #tt          i
    -----------
              1
              2(2 行受影响)作用是消除空值
      

  3.   

    ISNULL通俗的讲是用来消除空(NULL)值。语法: ISNULL(字段/变量,替代值)
      

  4.   


    declare @s varchar(1000)select isnull(@s,0)等同于select case when @s is null then 0 else @s end
      

  5.   

    declare @price money
    declare @count intselect @count = null , @price = 3.00select @count * @price as 'total_null', isnull(@count,0) * @price as 'total'select sum(@count * @price) as 'total_sum'
      

  6.   

    作用是判断某个值是否是null,并做相应转换
    不需跟什么函数公用
    在需要判断字段是否是转换null的时候使用
    例子:见独眼兄的例子