troubleshooting Question

dashes instead of zero values in a query

Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America asked on
Microsoft SQL ServerMicrosoft SQL Server 2008
9 Comments2 Solutions202 ViewsLast Modified:
Question: How can I have dashes instead of zero values in the following query?

This query works fine but at times has too many zeros.

Thank you.
	SELECT @nsql = 'Select left(m.MedCenter,13) As [Med Ctr], round(p.LastYearCount,0) as [' + @LY + ']
	, round(p.[01],0)as ''Jan'' , round(p.[02],0)as ''Feb'' , round(p.[03],0)as ''Mar'', round(p.[04],0)as ''Apt'', round(p.[05],0)as ''May'', 
		round(p.[06],0)as ''Jun'', round(p.[07],0)as ''Jul'', round(p.[08],0)as ''Aug'', round(p.[09],0)as ''Sep'', round(p.[10],0)as ''Oct'', round(p.[11],0)as ''Nov'', round(p.[12],0)as ''Dec''  
	FROM t08MedCenter AS m INNER JOIN t01YearlyPercent AS p 
	ON m.MedCtrID = p.MedCtr_ID' 
	EXEC (@nsql)
Join our community to see this answer!
Unlock 2 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros