Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SP as output for a select

Author  Topic 

Passero
Starting Member

12 Posts

Posted - 2008-01-23 : 09:49:34
I have a SP with an output parameter. I cannot rewrite the SP to a function because i use updates and inserts.
I also need that SP for a query. Normally i would write:

exec mySP @var, @result output;

now i want @result in a query like

select mySP(col1,... output) from table;

Is this possible?
I need this in a batch script
In fact, i need this in an update or insert statement.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-23 : 11:08:22
Try this & see if it works :-
SELECT m.*
FROM Table t
CROSS APPLY mySP(t.Col1,..OUTPUT) m
Go to Top of Page

Passero
Starting Member

12 Posts

Posted - 2008-01-24 : 03:07:11
THanks for the answer...

I've tried this as a test:

declare @t table(n int);
insert into @t values (1);
insert into @t values (2);
insert into @t values (3);
declare @r int
select n from @t t
cross apply dbo.bahu_number t.n,5,1,@r output

but i get an error:
Incorrect syntax near '.'
And it point to my last line.
Go to Top of Page
   

- Advertisement -