I have this MS SQL query inside the String.Format:
string sqlCommandx = String.Format("SELECT CASE WHEN sum(d1) > 0 THEN sum(n1)/sum(d1) ELSE null END as metricScore1 FROM DataBridgeStage Where programID={0} and DATEPART(m,reportingDate) = {1} and DATEPART(yyyy,reportingDate) = {2}",
ProgramID, month, year);
I'm getting an error that says: SQL logic error or missing database\r\nno such column: m. Is there a a problem with my syntax?