John writes "I read your article about using Case to dynamically build a select statement within a stored procedure. Worked on the basic select, but fails sytax check when I try to apply a CASE to build an IN condition for filtering in the from clause. Syntax checker points to the 'CASE @StatementType' line. I says "Incorrect syntax near the word case".select AcctPeriod, MasterAcctNbr, Case @CombDiv -- this works great, thanks!!! When 'C' then 0 When 'D' then Divnbr End as DivNbr from pvw_GL_Totals_By_Acct where AcctType in Case @StatementType --error occurs here When 'BS' then ('A','L','C') When 'PL' then ('E','R') EndMy goal is to pass two parameters to my procedure, @CombDiv and @StatementType, and dymically build the sql select from that. The resulting from clause would be either Where AcctType in ('A','L','C')or Where AcctType in ('E','R')Thanks,John FarmerWindows XPPro sp2MSSQL 2000 (developer) sp4"