读书人

关于局部变量的有关问题

发布时间: 2012-02-28 13:06:36 作者: rapoo

关于局部变量的问题
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 的结果是根据 查询分析器,工具--选项--结果--每列最多字符数来显示的

读书人网 >SQL Server

热点推荐