当前的表因为是随机生成的,是这个:@sqlTempTableName
exec( 'select '[email protected]+ '=Count(*) from '[email protected]+ ' where 1=1 and '[email protected])
类似下面的语句,我想得到这个表共有多少行,我应该怎么写了?问题就出在:@count那,不知道具体该怎么写,还请高手指教!
------解决方案--------------------
Declare @sqlTempTableName Varchar(1000), @searchFilter Varchar(2000), @count Int
Declare @S Nvarchar(2000)
Select @S = 'select @count=Count(*) from '[email protected]+ ' where 1=1 and '[email protected]
EXEC sp_executesql @S, N '@count Int output ',@count output