-
parameter returned by a execute
Hello,
How can I pass the value of the count(*) to outside the execute. I need the value to continue with the sp
set @sql= 'declare @res int select @res=count(*) from t
where tam=(select '+@posxx+' from sffpoxx0 where ponbr='+@Col001+' and poodn='+@Col002+' and pocat='+@Col007+')'
???????? set @result=exec (@sql) ????????????? Something like this
Thanks
Paulo
-
try this
select @countWidget = count(Widget)
from WidgetFile
Print @countWidget
Simon
-
I think, the EXEC statement cannot reurn OUTPUT parameters directly when TSQL script is run, instead a stored proc with an OUTPUT param can be run with the EXEC.
You can use sp_executesql to achieve this...
DECLARE @sql nvarchar(2000),@count INT
set @sql= 'select @var1=count(*) from t'
EXEC sp_executesql @sql,N'@var1 INT OUT',@count OUT
Last edited by jk121; 03-09-2004 at 11:21 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|