|
Posted by Hugo Kornelis on 10/02/99 11:48
On 23 May 2006 20:19:56 -0700, Radu wrote:
>Hi. I have a SP named, for instance, SP1.
>
>I need to execute something like
>
>SELECT Sum([Field1]) FROM SP1 WHERE [SP1].[Field1]='0'
>
>and I get the message:
>
>Server: Msg 208, Level 16, State 3, Line 1
>Invalid object name 'SP1'.
>
>However, SP1 *IS THERE* and runs fine !!!
Hi Alex,
I hope that you are not really trying to sum a character column or
comparing a numeric column to a string constant. And I also hope that
you're not really writing a query to calculate the SUM of lots of
zeroes. <g>
You can only include tables and views in a FROM clause, not stored
procedures.
Try it like this:
CREATE TABLE #temp
(Co1umn1 .....,
....)
INSERT INTO #temp (Column1, ...)
EXECUTE SP1
SELECT whatever
FROM #temp
WHERE Column1 = 0
--
Hugo Kornelis, SQL Server MVP
Navigation:
[Reply to this message]
|