select 
    Result=case when (  select convert(varchar(1000),  isnull(PathScript,'1=2'
                                                              )
                                      )
                        from RE_Path 
                        where FlowCode = @AuthID
                     )  
       then 1 
                else 0
           end
from  Table1
重排一下版面,这样看得比较清楚了。我看好象有语法错误。

解决方案 »

  1.   

    猜的:如果有记录就是1, 改一下就是:
    select Result=(case when exists(select convert(varchar(1000),  isnull(PathScript,'1=2')) from RE_Path 
                                             where FlowCode = @AuthID)  
     then 1 else 0 end)
    from  Table1
      

  2.   

    谢谢楼上的两位先! 
    To zheninchangjiang(john shu):  convert(varchar(1000),  isnull(PathScript,'1=2'))   不是没任何意义吗?
      

  3.   

    我想明白了!
    select 
        Result=case when (  select convert(varchar(1000),  isnull(PathScript,'1=2'
                                                                  )
                                          )
                            from RE_Path 
                            where FlowCode = @AuthID
                         )  
           then 1 
                    else 0
               end
    from  Table1
    其中:
    "select convert(varchar(1000),  isnull(PathScript,'1=2'
                                                                  )
                                          )
                            from RE_Path 
                            where FlowCode = @AuthID"
    会得到一个表达式,如col1=col2 ,而Table1 中有列col1,col2, 
    所以是比较table1中col1,col2是否相等!再次谢谢两位仁兄!