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)
 Stored Procedure Parameter

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-01-30 : 08:39:52
Brian M writes "I'm doing a UNION query using Select Count(*).

I'm getting this error:
ADO error: Only the first query in a UNION statement can have a SELECT with an assignment

@outparm int 'declared....

SELECT @outparm =COUNT(*)

blah blah blah

UNION

SELECT @outparm =COUNT(*)

blah blah blah

etc...

The query works GREAT outside of the stored procedure. Once I put it in there and use the @outparm it does NOT like it!

Any advice?
Thanks.
Brian"

Nazim
A custom title

1408 Posts

Posted - 2002-01-30 : 09:03:48
you cant assign values that way with unions. As the Error clearly states you can only assign values in first select in a union.





--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page
   

- Advertisement -