Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a query that returns over a hundred columns. The column names contain important underscores, >, < and Uppercase/lowercase characters. However, when creating the reports, SSRS designer (3.0) automatically added spaces and convert these special characters to spaces. It's really annoying. Is it possible to disable this SSRS feature?


How much work would it be to fix the headers using the following two methods?

  1. Use a script to update the column header back to the original column name.

  2. Transform the XML reporting rdl file.

share|improve this question
    
Is this happening in the designer, in the output of the report (CSV, XLS, etc.), or both? – OliverAsmus Mar 15 '12 at 12:22
    
@OliverAsmus Both – u23432534 Mar 15 '12 at 18:30
    
Hmm . . . I have not seen this feature as an option in SSRS. However, you can use regular expressions in the column headers to manipulate how the text is displayed - msdn.microsoft.com/en-us/library/ms157328.aspx – OliverAsmus Mar 15 '12 at 18:37
  1. Find and Replace one of the desired characters, such as an Underscore, in the dataset query SQL with a non-sense string, such as "3145234jhasdf" ..... (minus the quotes).
  2. In Report Builder, create a DataSet with the resulting data.
  3. Create a Tablix with that DataSet. The headers in the Tablix will now look odd. As an example the header, "Column_One", will now look something like this: "Column3145234jhasdfOne".
  4. Save the file on your desktop or other local directory. It will be an RDL file. Close Report Builder.
  5. Open the resulting RDL file you saved in a text editor, such as Notepad++. You will see XML code.
  6. Find and Replace your non-sense string: "3145234jhasdf", with the character you want it to display your headers: "_".
  7. Save the file. Close the text editor.
  8. Open the file in Report Builder. Your headers should look like you want it.

You can replace more than one type of character by choosing a different non-sense string for each. For ease, keep the string alphanumeric with no spaces.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.