Thursday, May 30, 2013

Two Column Report Based on Multiples of Integers

check this,



create table #test (column1 Int identity(1,1),Column2 varchar(10))
go

insert into #test default values
go 102

go

update #test
set Column2 = case
when column1%4 = 0 AND column1%7 = 0 then 'green'
when column1%4 = 0 then 'blue'
when column1%7 = 0 then 'yellow'
else Column2
END
select * from #test





Thanks

Sarat



Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.


No comments:

Post a Comment