Created
June 12, 2012 19:33
-
-
Save swasheck/2919639 to your computer and use it in GitHub Desktop.
twonulls sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @test table ( | |
id integer identity(0,1) not null, | |
dt1 datetime, | |
dt2 datetime | |
) | |
insert into @test (dt1) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt1) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt1) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt1) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt2) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt2) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt2) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt2) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt1,dt2) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate()),dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt1,dt2) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate()),dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt1,dt2) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate()),dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt1,dt2) VALUES (dateadd(DAY, cast((rand() * 100) as int), getdate()),dateadd(DAY, cast((rand() * 100) as int), getdate())) | |
insert into @test (dt1,dt2) VALUES (NULL,NULL) | |
insert into @test (dt1,dt2) VALUES (NULL,NULL) | |
insert into @test (dt1,dt2) VALUES (NULL,NULL) | |
insert into @test (dt1,dt2) VALUES (NULL,NULL) | |
select * | |
from @test | |
Where (dt1 is not null or dt2 is not null) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment