sql - SELECT specific columns from EXEC stored procedure -
i having issue trying select
specific columns exec
statement on stored procedure. trying find count(*)
stored procedure returns doing :
insert #temp exec dbo.my_sp set @count = (select count(*) #temp) delete #temp
however, works if columns returned match table columns , since trying find count of many different stored procedures (each of return different columns), cannot use method without creating new table each stored procedure.
is there way can select
specific columns exec dbo.my_sp
?
would @@rowcount work you?
if object_id('someproc') null exec ('create procedure dbo.someproc select 1 somevalue union select 2 somevalue;') exec dbo.someproc select @@rowcount rowsaffected
http://technet.microsoft.com/en-us/library/ms187316(v=sql.105).aspx
Comments
Post a Comment