strangeBrew12
Programmer
I have the following select statement that is not working as I expect. This will run and pull out data, but it acts as iff the not in clause does not exist.
Select *
FROM ##BatchTransaction bt
join Terminal t
on bt.TrNo = t.ATTrNo
join Agent a
on t.AgentID = a.AgentID
where a.agenttype
not in(''''+REPLACE(REPLACE('1,2,3 , A, b ,C',' ', ''), ',', ''',''')+'''')
But when I manually type in this it works as expected.
Select *
FROM ##BatchTransaction bt
join Terminal t
on bt.TrNo = t.ATTrNo
join Agent a
on t.AgentID = a.AgentID
where a.agenttype
not in('1','2','3','A','B','C')
This is actually part of a stored procedure where the 'Not In' value is a random variable that is passed from the front end application.
Hopefully someone can help me with this.
Regards
JJ
Select *
FROM ##BatchTransaction bt
join Terminal t
on bt.TrNo = t.ATTrNo
join Agent a
on t.AgentID = a.AgentID
where a.agenttype
not in(''''+REPLACE(REPLACE('1,2,3 , A, b ,C',' ', ''), ',', ''',''')+'''')
But when I manually type in this it works as expected.
Select *
FROM ##BatchTransaction bt
join Terminal t
on bt.TrNo = t.ATTrNo
join Agent a
on t.AgentID = a.AgentID
where a.agenttype
not in('1','2','3','A','B','C')
This is actually part of a stored procedure where the 'Not In' value is a random variable that is passed from the front end application.
Hopefully someone can help me with this.
Regards
JJ