我尝试为我声明的变量添加值,我只是新手,希望你能给我一个关于这个的一般想法。感谢
ALTER PROCEDURE [dbo].[testsp]
@y int =0,
Select
case when column1 <> ''
then
@y+=1 - Add value to y
'0'+ @y - display current value of y
end
From table
答案 0 :(得分:0)
我已将你的Proc重写为下面的内容:
ALTER PROCEDURE [dbo].[testsp]
AS
BEGIN
DECLARE @y INT =0
SELECT
@y = --You Can Ignore This Line Since Not neccessary
CASE WHEN ISNULL(column1,'') <> ''
THEN @y+1
ELSE @y END
FROM [TABLE]
END