sql错误

wishY 2008-03-27 07:19:05

declare @adnum int

Declare @sql_adnum2 nvarchar(500)
set @sql_adnum2 = 'SELECT @adnum = COUNT(AdminInfo.AdminID)
FROM AdminInfo INNER JOIN
AdminGrade ON AdminInfo.AdminGradeID = AdminGrade.AdminGradeID INNER JOIN
Sub_department ON
AdminInfo.Sub_departmentID = Sub_department.Sub_departmentID
where AdminInfo.Active = ''true'' and Sub_department.Sub_departmentID = '''+cast(@Sub_departmentID as nvarchar(4))+'''
'
exec (@sql_adnum2)
select @adnum


这样为什么查不出来,要怎么修改?错误:@adnum未定义.
...全文
8 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复

还没有回复,快来抢沙发~

相关推荐
发帖
MS-SQL Server
创建于2007-09-28

3.3w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
帖子事件
创建了帖子
2008-03-27 07:19
社区公告
暂无公告