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 2000 Forums
 SQL Server Development (2000)
 exec stored proc as element of a select statement?

Author  Topic 

mattd
Starting Member

11 Posts

Posted - 2001-02-12 : 12:04:53
Hi all,

I have a stored procedure, sp_util_getauthorstring, which returns a single value. I'd like to include this value as part of a larger select statement. Assuming the procedure itself works when called separately, can anyone tell me why the following...


select exec(sp_util_buildauthorstring 2,1,'=','^') as authorlist


...fails to work? The errors I'm getting are:


Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'exec'.
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'sp_util_buildauthorstring'.


I've tried all the permutations of spaces and parentheses I can think of, and searched both the site and the forum, with no luck.

Thanks in advance,

matt
   

- Advertisement -