Hi,
I would like to return a value from a stored procedure. However, I am using UNION to join a lot of tables together and I keep getting an error:
A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
Would anyone know how to do this?
Thanks,
Jenny
E.G.
CREATE PROCEDURE proced
@docId int
@@logProvider varchar (40) OUTPUT
AS
select @@logProvider=logProvider,
eventId
from tableA
where docId=@docId
union
select @@logProvider=logProvider,
eventId
from tableB
where docId=@docId
.....
I would like to return a value from a stored procedure. However, I am using UNION to join a lot of tables together and I keep getting an error:
A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
Would anyone know how to do this?
Thanks,
Jenny
E.G.
CREATE PROCEDURE proced
@docId int
@@logProvider varchar (40) OUTPUT
AS
select @@logProvider=logProvider,
eventId
from tableA
where docId=@docId
union
select @@logProvider=logProvider,
eventId
from tableB
where docId=@docId
.....