读书人

50分问个初学者有关问题!比较急多谢了

发布时间: 2012-01-18 00:23:26 作者: rapoo

50分问个菜鸟问题!!!比较急。谢谢了。

语句如下:
==========================
select @int_allid=count(sID) from PPOK_House
==========================

我现在要把这句加上一句外部给入的条件@str_SQLWhere

请问如何添加?

注意:
select @int_allid=count(sID) from PPOK_House @str_SQLWhere
这样不行。


[解决办法]
declare @sql nvarchar(1000)
set @sql=N 'select @int_allid=count(sID) from PPOK_House '+@str_SQLWhere

exec sp_executesql @sql,N '@int_allid int output ',@int_allid output

读书人网 >SQL Server

热点推荐