SQLTeam.com | Weblogs | Forums

Store procedure

I am starting learning how to do this this in the store procedure.  All working fine, except making the different bglcolor based on the status.I want to change the color green and red of the cell based on the value.  When completed, make bglor ="green", when errors, make bgcolor ="red"  I am not sure how to put the syntax together, can anyone help? Thanks

Set @tableHTML=@tableHTML +

					N'<table border="1" cellspacing="1" width="500">' +
					N'<tr align="center"><th>comp</th><th>DailyProcess</th><th>Monthly Process</th><th>Sales Process</th><th>Status Process</th></tr>' +
					CAST((Select 'center' 'td/@align'
									,'center' 'td/@align'
									,'center' 'td/@align'
									,'center' 'td/@align'
									,'center' 'td/@align'
										when daily is null  then  ' complete'  
										when dailyRERR =1  then ' errors.' 
									from sales	
							  		FOR XML PATH('tr'), TYPE) AS NVARCHAR(max)) + 
					N'</table>' +