cheryl9063
asked on
t-sql
declare @ReqStatusDE int
if @ReqStatusDE in (select id from Requisition_Status_DE rsde where EntryCode in ('LockWait', 'Locked', 'Trans', 'LocNevTran'))
The select statement returns 5 rows.. What error will the above syntax give you?
if @ReqStatusDE in (select id from Requisition_Status_DE rsde where EntryCode in ('LockWait', 'Locked', 'Trans', 'LocNevTran'))
The select statement returns 5 rows.. What error will the above syntax give you?
ASKER
Would it give you the error
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. ?
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. ?
ASKER
A vendor did this and we are getting that error.. I think this is the part of the code that needs to be changed..
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
it wont throw any error because of the 'IN', if it was an '=' it would have.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Likely 'Can't find table Requisition_Status_DE', as I don't have access to your data source.
What's your question?
Maybe...
declare @ReqStatusDE int
SELECT @ReqStatusDE = 42 -- or something
IF EXISTS (
select id
from Requisition_Status_DE rsde
where EntryCode in ('LockWait', 'Locked', 'Trans', 'LocNevTran')
and id = ReqStatusDE )
begin
-do whatever if it exists
end