FYI: workaround for report sql and the error "System.Xml.XmlException: The '#' character, hexadecimal value 0x23, cannot be included in a name."

Monday, August 25, 2014 8:42:41 PM
FYI:  If you are writing report SQLand run into the following error:  "System.Xml.XmlException: The '#' character, hexadecimal value 0x23, cannot be included in a name."

...then make sure you aren't selecting two columns from two separate tables with the exact same name.  Use aliasing to prevent the problem.

For example, the following SQL will cause a problem:

SELECT rel.NAME, req.NAME FROM SpiraTestEntities.R_Releases AS rel LEFT JOIN SpiraTestEntities.R_Requirements AS req on rel.RELEASE_ID = req.RELEASE_ID WHERE rel.PROJECT_ID = ${ProjectId}

The following SQL is equivalent except the column name aliases will preclude the aforementioned error:

SELECT rel.NAME AS rel_Name, req.NAME AS req_NAME FROM SpiraTestEntities.R_Releases AS rel LEFT JOIN SpiraTestEntities.R_Requirements AS req on rel.RELEASE_ID = req.RELEASE_ID WHERE rel.PROJECT_ID = ${ProjectId}

1 Replies
Thursday, August 28, 2014 1:38:59 PM
Avatar
re: jfreed on Monday, August 25, 2014 8:42:41 PM
Thanks for the information, Jon!
Statistics
  • Started: Monday, August 25, 2014 8:42:41 PM
  • Last Reply: Thursday, August 28, 2014 1:38:59 PM
  • Replies: 1
  • Views: 1916