SQL Server Report Builder Field Formatting - sql

I am creating Reports in SQL Server Report builder.
When I set format of any number fields, in design it is displaying sample value.
For e.g. If I set format 0.00 to one numeric field, it started to display 12345.00
I have 10-12 fields in design, it caused very much confusion.
Is there any solution to change this?
When I open report in Visual Studio, it doesn't display like that.
Check Following screenshots:
In Report Builder:
In Visual Studio:

Finally, I got solution:
There is option in toolbar

Related

VB.Net - Visual studio 2010 and Crystal Report, how to pass a query?

I'm looking for make a Report in vb.net using Crystal Report, but i don't understand how to pass a query and specify the target textlabel through a query. I means execute a query and render a datatable, how can i target the crystal report's fields as soon as i have made the query? Without connecting database through procedure, only with a connection string.
Thank you in advice and sorry for my bad english.
What you could do is first of all call your query and bind the binding source with the data table and have some text boxes or labels binded to this data source. Now create parameters in your crystal reports and pass these values stored in text boxes or labels into parameters. Look at this website for example on how to create and pass parameters:
http://vb.net-informations.com/crystal-report/vb.net_crystal_report_parameter_string.htm
I hope it works for you, I am sorry if I couldn't help.

Can i pass a parameter from a calculated member on a ssas 2008 cube to cognos report studio?

Can i pass a parameter from a calculated member on a ssas 2008 cube to cognos report studio? I know how to do this in Microsoft reporting sevices, but not Cognos Report Studio 10.1. I do not know the format the calculated member should be in, or how to get Cognos to recognize any parameters passed. Example: Say i wanted to pass the code below, that shows the top 25 accounts, but instead, i wanted to adjust it to have a variable / parameter that enabled me to adjust it at run time to say the top 10 accounts. Is this possible. I know i can create the code in report studio itself, but i would rather do it in the cube for performance and re-usability reasons. Here is a copy of this particular example and thank you!
TOPCOUNT( [Instrument].[Account Name].[Account Name].members,
25, [Measures].[Committed Amt])**strong text**
If I understood you correctly, you can do it in the following way:
Drag a data item into the query and use the embeded parameter (?prmTopCount?):
topeCount([Instrument].[Account Name].[Account Name],
?prmTopCount?, [Measures].[Committed Amt])
You can build a prompt page and define a textBox Prompt which uses existing prompt (prmTopCount).
I have also tried to write manual MDX in the report, but it looks it does not support macros embedded inside the manual written MDX.

Saving results with headers in SQL Server Management Studio

I am using SQL Server Management Studio.
I wish to save the results of a query to an excel file.
I choose "save as" and then save to CSV file which I can open in excel. All good except I am missing column headers, any ideas how I get them exported?
Tools > Options > Query Results > SQL Server > Results to Text (or Grid if you want) > Include columns headers in the result set
You might need to close and reopen SSMS after changing this option.
On the SQL Editor Toolbar you can select save to file without having to restart SSMS
Try the Export Wizard. In this example I select a whole table, but you can just as easily specify a query:
(you can also specify a query here)
Another possibility is to use the clipboard to copy and paste the results directly into Excel. Just be careful with General type Excel columns, as they can sometimes have unpredictable results, depending on your data. CTL-A anywhere in the result grid, and then right-click:
If you have trouble with Excel's General format doing undesired conversions, select the blank columns in Excel before you paste and change the format to "text".
At least in SQL Server 2012, you can right click in the query window and select Query Options. From there you can select Include Headers for grid and/or text and have the Save As work the way you want it without restarting SSMS.
You'll still need to change it in Tools->Options in the menu bar to have new query windows use those settings by default.
The settings which has been advised to change in #Diego's accepted answer might be good if you want to set this option permanently. Permanently means it'll apply to all future query sessions that you open within SQL Server Management Studio(SSMS). This is usually not the case. Also, changing this setting requires restarting SQL Server Management Studio (SSMS). This is again a not-so-nice experience in case there are many unsaved query session windows open and you are in the middle of debugging something.
SQL Server gives a much slicker option of changing this setting on per session basis which is very quick and convenient. I'm detailing the steps below using query options window:
Right click in query editor window. Now, click Query Options... in the context menu as shown below:
Select Grid under Results node in the left navigation pane. Now, check the Include column headers when copying or saving the results check box as shown below:
That's it. Now, your current query session will start honouring your settings with immediate effect. You don't need restarting SSMS. Also, this setting won't be propagated to any future session either. Effectively, changing this setting on a per session basis is much less noisy.
The same problem exists in Visual Studio, here's how to fix it there:
Go to:
Tools > Options > SQL Server Tools > Transact-SQL Editor > Query Results > Results To Grid
Now click the check box to true: "Include column headers when copying or saving the results"
Select your results by clicking in the top left corner, right click and select "Copy with Headers".
Paste in excel.
Done!
Got here when looking for a way to make SSMS properly escape CSV separators when exporting results.
Guess what? - this is actually an option, and it is unchecked by default. So by default, you get broken CSV files (and may not even realize it, esp. if your export is large and your data doesn't have commas normally) - and you have to go in and click a checkbox so that your CSVs export correctly!
To me, this seems like a monumentally stupid design choice and an apt metaphor for Microsoft's approach to software in general ("broken by default, requires meaningless ritualistic actions to make trivial functionality work").
But I will gladly donate $100 to a charity of respondent's choice if someone can give me one valid real-life reason for this option to exist (i.e., an actual scenario where it was useful).
In SQL Server 2014 Management Studio the setting is at:
Tools > Options > Query Results > SQL Server > Results to Text > Include column headers in the result set.
I also face the same issue. When I used right click in the query window and select Query Options. But header rows does not show up in output CSV file.
Then I logoff the server, login again and run the script. Then it worked.

Howto: Display a parameter on a SQL Server Report?

I'm creating some reports in Visual Studio BIDS, out of our SQL Analysis Server 2008.
The report works fine, and uses an MDX query with parameters. So far, so good.
The problem is that I would like to display the parameter on the report. For example, I would like to display the 'Month' of the Date parameter, but it shows up on the report like this:
[Date].[Month].&[2010-01-01T00:00:00]
Not really what I want. How can I display this value as 'January' ? I can't find any function which does this. The only way I see this is possible is to include the date value in the returned fields.
Does anyone have experience with this?
I fixed this by adding the necessary values in the Select-fields.

Format SQL query results

I am looking for a way to set the width on the returned column result from a SQL query.
I run a query like Select Product from ConfigScheduling where Product is an Nvarchar(Max) column.
The result in SQL Server Management Studio with Results to Grid is a 90 char wide visible column, with the full result present, but not visible.
Thank you
Couldn't find it by default, but if you double-click on the right part of the Column Header it will stretch like in Excel.
Tools>Options>Query Results>SQL Server>Results to Grid>Non XML data
Tools>Options>Query Results>SQL Server>Results to Text>Maximum number of characters displayed in each column.
If these still don't suit your needs, you'll need to use another tool such as bcp or sqlcmd/osql.
If I remember correctly, SQL Server Management Studio cannot pull the whole nvarchar(max) field into display and won't attempt to either. The only way to fully access the resultset is to use a third party tool or display it in a gridview or something in a webapp.