Hello and thank you for taking a moment. I am trying to build a table by looping through the contents of an existing table. Once built I try to select from the newly created table (@BPRLIKELISTRESULTS) but sql server gives the following error:
[Msg 4145, Level 15, State 1, Line 32
An expression of non-boolean type specified in a context where a condition is expected, near 'SELECT'.
Line 32 is the select statement at the bottom of my query here below. If there is any advice as to how to solve this , it would be greatly appreciated.
DECLARE @RowsToProcess int
DECLARE @CurrentRow int
DECLARE @SelectCol1 int
DECLARE @BPRLIKELISTRESULTS TABLE ( Value varchar(20))
DECLARE @BPRLIKELIST TABLE (RowID int not null primary key identity(1,1), Listitem varchar(20))
INSERT into @BPRLIKELIST (Listitem)
WHERE (ReqTitle = 'BPR') and (Active = 1) and (Operator = 'Like') and (UserID = 3183)
Select * From @BPRLIKELIST
Insert into @BPRLIKELISTRESULTS (Value)
Select Distinct officeLocation
Where (Select Listitem from @BPRLIKELIST where RowID=@CurrentRow)