I just ran a simple test:
create table #NullTest (
ID int identity primary key,
insert into #nulltest (date)
when number%10 > 0 then dateadd(day, number, '1/1/2000')
set statistics io on
set statistics time on
declare @Date datetime
select @date = isnull(date, getdate())
I used both coalesce and isnull in the final query. Coalesce took an average of 350 milliseconds, isnull took an average of 328 milliseconds.
More complex queries might make a bigger difference, but coalesce was consistently about 8-9% slower in this case.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon