declare @Migrationdate datetime,@MigrationIndicator int
set @Migrationdate='6/13/2012'
set @MigrationIndicator=0
declare @temp table (accountid int , accountdate datetime)
insert into @temp (accountid, accountdate)
select 123,'6/12/2012' union
select 124,'6/13/2012' union
select 125,'6/14/2012'
(The @migrationindicator will be 0 for pre migration and 1 for post migration).
I want to select rows from table, in this criteria. Also, instead of using an IF, is it possible to do a CASE statement in the WHERE clause to achieve this. Because, i want to hook up this piece to an existing stored procedure.
if @migrationindicator=0 then
select * from tablename where field1<=@migrationdate
if @migrationindicator=1 then
select * from tablename where field1>@migrationdate
Thanks.
NSG12