首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

关于局部变量的有关问题

2012-02-28 
关于局部变量的问题declare@avarchar(8000)set@aselectcasewhen(selectsum(isnull(m7,0))fromcount_for_o

关于局部变量的问题
declare   @a   varchar(8000)


set   @a   =   'select   case   when   (select   sum(isnull(m7,0))   from   count_for_ok   where   用工类别     in  


(select   QZ   from   ZZQZLB)   and   数据分类   in   (select   ZZ   from   ZZQZLB)   and   年度   =   2007   and  


dept_code   in   (select   dept_code   from   deptcode   where   dept_code   between   11601   and   11699))   =0     then   0   else   (select   sum(isnull(m7,0))   from   count_for_ok   where   用工类别     in   (select   QZ   from  

ZZQZLB)   and   数据分类   in   (select   ZZ   from   ZZQZLB)   and   年度   =   2007   and   dept_code   in  
(select   dept_code   from   deptcode   where   dept_code   between   11601   and   11699)) '


select   @a

为什么得到的结果,只显示


'select   case   when   (select   sum(isnull(m7,0))   from   count_for_ok   where   用工类别     in  


(select   QZ   from   ZZQZLB)   and   数据分类   in   (select   ZZ   from   ZZQZLB)   and   年度   =   2007   and  


dept_code   in   (select   dept_code   from   deptcode   where   dept_code   between   11601   and   11699))   =0  


后面一段却不见了?


我把这句分成两个char变量,然后select   @a+@b   也不行。。。
请问是什么原因?
请问如何解决?

[解决办法]
select 的结果是根据 查询分析器,工具--选项--结果--每列最多字符数来显示的

热点排行