Avatar of 25112
25112
 asked on

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
Microsoft SQL ServerMicrosoft SQL Server 2008SQL

Avatar of undefined
Last Comment
25112

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rimvis

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
deighton

select top 1000  
case when isdate(backup_start_date) = 1 then CONVERT(VARCHAR(10), backup_start_date, 120) else '0' end Date,  
count(*) VERIFYNumberOfLogBackupsPerDay
from 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' end
order by 1 desc 

Open in new window

SOLUTION
deighton

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
John Claes

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
deighton

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Patrick Matthews

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
25112

ASKER
impressive-- thanks
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes