存储过程中赋值的问题
createprocedure[dbo].[chaxunchuqinlv]@namevarchar(20),@datemindatetime,@datemaxdateti...
create procedure [dbo].[chaxunchuqinlv]
@name varchar(20),
@datemin datetime,
@datemax datetime,
@shuchu int output
as
declare @i int,@j int
SELECT @i = COUNT(b.SignTag)
FROM UserInfo AS a INNER JOIN
ManualSign AS b ON a.UserId = b.UserId
WHERE (@datemin < b.SignTime) AND (b.SignTime < @datemax)
AND (b.SignTag = 1)
AND (b.ManualSign < '08:30')
AND (DATENAME(weekday,b.SignTime) <> '星期六')
AND (DATENAME(weekday,b.SignTime) <> '星期日')
AND (a.UserId = @name)
SELECT @j = COUNT(b.SignTag)
FROM UserInfo AS a INNER JOIN
ManualSign AS b ON a.UserId = b.UserId
WHERE (@datemin < b.SignTime) AND (b.SignTime < @datemax)
AND (b.SignTag = 0)
AND (b.ManualSign < '17:30')
AND (DATENAME(weekday,b.SignTime) <> '星期六')
AND (DATENAME(weekday,b.SignTime) <> '星期日')
AND (a.UserId = @name)
怎样把 @i和@j 相加 赋值个给@shuchu 展开
@name varchar(20),
@datemin datetime,
@datemax datetime,
@shuchu int output
as
declare @i int,@j int
SELECT @i = COUNT(b.SignTag)
FROM UserInfo AS a INNER JOIN
ManualSign AS b ON a.UserId = b.UserId
WHERE (@datemin < b.SignTime) AND (b.SignTime < @datemax)
AND (b.SignTag = 1)
AND (b.ManualSign < '08:30')
AND (DATENAME(weekday,b.SignTime) <> '星期六')
AND (DATENAME(weekday,b.SignTime) <> '星期日')
AND (a.UserId = @name)
SELECT @j = COUNT(b.SignTag)
FROM UserInfo AS a INNER JOIN
ManualSign AS b ON a.UserId = b.UserId
WHERE (@datemin < b.SignTime) AND (b.SignTime < @datemax)
AND (b.SignTag = 0)
AND (b.ManualSign < '17:30')
AND (DATENAME(weekday,b.SignTime) <> '星期六')
AND (DATENAME(weekday,b.SignTime) <> '星期日')
AND (a.UserId = @name)
怎样把 @i和@j 相加 赋值个给@shuchu 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询