如题所述
--sql server
--比如将满足条件的数据笔数赋值给变了@i
declare @i int
select @i=count(*) from tableName where ...
--比如将满足条件的数据笔数赋值给变了@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 条件
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 条件