Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
create table #a ( ident int identity, a int,b int)
insert into #a (a,b)
select n, case when n%10000=0 then 0 else case when n%300=0 then 2 else n/2 end end
from vw_nums
where n < 500000
select ident,a,b,a/b from #a
where b<>0 and b is not null
select ident,a,b,a/b from #a
where ident in (select ident from #a where b <> 0 and b is not null)
go
drop table #a
create table #a ( ident int identity, a int,b int)
insert into #a (a,b)
select n, case when n%10000=0 then 0 else case when n%300=0 then 2 else n/2 end end
from vw_nums
where n < 500000
select ident,a,b,a/b from #a
where b<>0 and b is not null
select ident,a,b,a/b from #a
where ident in (select ident from #a where b <> 0 and b is not null)
select ident,a/b from #a
where b<>0 and b is not null
select ident,a/b from #a
where ident in (select ident from #a where b <> 0 and b is not null)
go
drop table #a
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
T-SQL to Update Table Dynamically | 2 | 61 | |
SQL Server 2012 express | 24 | 42 | |
Find results from sql within a time span | 11 | 55 | |
Ideas on migrating very large system from SQL 2005 to SQL 2014 | 3 | 29 |
Join the community of 500,000 technology professionals and ask your questions.