if @Processed = 1
begin
set @ColumnDateType = 'dbo.table1.DateProcessed'
end
else
begin
set @ColumnDateType = 'dbo.table1.EligibilityDate'
end
SELECT col1,col2
FROM table1
where
@ColumnDateType between @BeginDate and @EndDate
The where clause gives a conversion error when I have the @ColumnDateType variable in it.
|