fill in row (date) when chronological date is missing in result
in the below query, how can you bring a value of zero on the row when there is no value returned for that date in the query?
select top 1000 CONVERT(VARCHAR(10), backup_start_date, 120) Date, count(*) VERIFYNumberOfLogBackupsPerDay
from msdb..backupset where database_name = 'cognox_bk' and type ='L'
group by CONVERT(VARCHAR(10), backup_start_date, 120)
order by 1 desc
select top 1000 case when isdate(backup_start_date) = 1 then CONVERT(VARCHAR(10), backup_start_date, 120) else '0' end Date, count(*) VERIFYNumberOfLogBackupsPerDayfrom msdb..backupset where database_name = 'cognox_bk' and type ='L'group by case when isdate(backup_start_date) = 1 then CONVERT(VARCHAR(10), backup_start_date, 120) else '0' endorder by 1 desc
Open in new window