要怎么样才能把SQL语句的值赋给一个变量

如题所述

--sql server
--比如将满足条件的数据笔数赋值给变了@i
declare @i int
select @i=count(*) from tableName where ...

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-01-18
declare @bl as nvarchar(6)

select @bl=case when 查询列名-9>SUBSTRING( 查询列名,1,4)+'00' then 查询列名 -9 else cast(cast(SUBSTRING( 查询列名,1,4)-1 as nvarchar(4))+'12' as int) +SUBSTRING( 查询列名,5,2)-9 end
from 表 where 条件

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网