Declare @TB int Select @TB = TypeB from ExpFrameWork where Category = '40' print @TB && prints 5 - like I'd expect it to. Select top @TB from ExpMaster where Category = '40' and Difflet = 'B' *The above has the red line under it and says Incorrect syntax near @TB. Expecting REAL, INTEGER, NUMERIC or '('If I replace @TB with (@TB) it gives me 'Incorrect syntax near from'
>SELECT TOP (expression) ... >>
>>Cat TypeB TypeC TypeD TypeE >>---------------------------------------------------------------- >>40 5 3 6 4 >>41 >>. >>. >>. >>>>
>>Select top 5 from (filename) where Cat = '40' and DiffLet = 'B' >>Union >>(Select top 3 from (filename) where Cat = '40' and DiffLet = 'C' >>Union >>... >> >>>>
>>Select top TestFrameWork.TypeB from (filename) where Cat = '40' and DiffLet = 'B' >>>>?