.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

How to FORMAT a AVERAGE number

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :Sql Server

How can i write a similar query like this in TSQL?


this was written in SSRS

View Complete Post

More Related Resource Links

proper format for number column

Hi  In a column i have number datatype but after filling some no it's giving like that 23,786,23 (mostly like a currency format ) but i need like that 2378623 so give me suggestion how i can implement this in sharepoint 2010 , is there need to bound some column level validation for that ............... 

Format phone number in asp.net textbox control

Hi,  I have a <asp:textbox> control, I want to display text as a phone number format like phone number mask. Anybody can help on this. Thanks in advance.

format-number issues with the Data View Web Part in SharePoint 2010

I have a number column named @Year_x0020_1_x0020_Revenue in the data view web part in SharePoint Designer 2010. In the Xpath expression builder - @Year_x0020_1_x0020_Revenue previews "500,000" If I use the format-number in the Xpath expression builder ==> format-number(@Year_x0020_1_x0020_Revenue, '$#,##0.00;-$#,##0.00'), it returns NaN. Is there any reason? 

Average number of products by customer in segment

Hi again, I have performance issue with one query, and hope that you will help me as always. I am getting exact result, but with poor performance (more than 20 minutes) with member   [Measures].[SumProductsByCustomer] as Avg ( existing {[Customer].[Customer_ID]. Children},     Filter ( ( {[Product_Arrangement_BasedOnProductId].[Product]. Children}     --, ), [Measures].[AvgArrangementCount]>0 ) )   Select   NON EMPTY [Measures].[SumProductsByCustomer]   on 0, [MarketSegment_Customer_MarketSegmentId].[MarketSegmentName]   on 1 from   [CPM] What I want is to calculate average number of different products by customers and than show avg number of different products by customer in every segment.   Thank you very much for any idea.    

String.Format rounding down floating point number


Hi, I'm having an issue with String.Format, can somebody tell me if it's something I'm doing.


I'm using C# 2.0 I have code which looks a little bit like this:


Code Snippet

string result;

float floatToConvert = 10780503.000000f;


result = String.Format("{0:0,0}",floatToConvert);



Now I would expect result to have a value of "10,780,503" after this line of code, but it doesn't it has a value of "10,780,500"...


If however I do this:


Code Snippet

string result;

float floatToConvert = 10780503.000000f;

Format a number to show as 10.00


I feel really stupid but I just don't understand where I go wrong

All I try to do is to display 10 as 10.00

Dim amount As Double = 10
        lblAmount.Text = Format(amount, "##,##0.00")

And what I am getting is this


Please help


Hi Experts.... I'm trying to get Fiscal Weeks in the form of year + week number in 6 digit format b

CONVERT(int,(cast(datepart(year, AuditDate) as varchar) + (case when (datepart(WK , AuditDate) < 9) then '0' else '' end) + cast(datepart(WK , AuditDate) as varchar))) As 'FiscalWeekId' 

20069 > 200609
20069 > 20060

format the number in indian currency format


hi.... to all..

i'm using sql server 2008 express with advance edition with BIDS...

i've developed one report in that employee salary.. 

i want to print the salary in the format (12,34,56,78,91,01,11,233.89)

and i want to print in words

such as (" ninty  nine crores fifty one lakhs fourty nine thousand four hundred and fourty five rupees and seventy nine paise ")

i.e in crores and lakhs (indian currency format)...

please help me....


please correct the code (indian number format code)



The code is about place the comma's (,) i.e separator between numbers
in this format (12,21,21,123) it works good..
but when there's a decimal point such as 12345.58 it will show as 12,346.. 
it will round up the values.. ( which i dont want that .. i want as it value to be printed )
and one more problem  if there five digit with two decimal i.e(12345.00) it will show correct
i.e (12,345.00) but if i there four digit with two decimal i.e(1234.00 ) it will show this #error

Different Culture number format using a website


Hi All,

I have problem to showing numer format for different culture using browser in client side. I am explain here what i am facing the issue. 

For example,

I have a application which is installed in IIS7 at datacenter in Germany. Database is in Germany. After installing my application i will run my application in hosting server when i have set chines language in hosting server browser. Next it will works perfect for Indian and Chines languages in local browser. Because indian and chines language same decimal separater and thousand separater. 

My problem is, when i change german language in local browser then it won't work. Number format is showing wrong. For example, actual value is 5.5000. But it showing  55,0000. it should show 5,5000.

Please someone to help me to resolve this issue



Changing number format


I receive price values in the format [100,00-]

this needs to be converted to -100000. 


I used a derived column with the function REPLACE([Column 0],",",".")

But, obviously the negative value is not being recognised. So I get [100000-]

Please advise.

Thank you.





How To Set a Date Format In GridView Using ASP.NET 2.0

A very common desire is to set a column of a gridview to display just the month, day and year of a DateTime type. The problem is the by default, the HtmlEncode property of the boundfield attribute (
The problem is that if this field is enabled, you can not pass format information to the boundfield control. That is, if you try the following code, you will not get the desired result.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

How to format datetime & date with century?

Execute the following Microsoft SQL Server T-SQL datetime, date and time formatting scripts in Management Studio Query Editor to demonstrate the usage of the multitude of temporal data formats available and the application of date / datetime functions.


Program for Format Conversion of An Image

.NET provides extensive support for image conversion. Any image can be processed from one format to another. Most common formats to which .NET have support for are .BMP, .EMF, .GIF, .ICO, .JPG, .PNG, .TIF and .WMF.

Convert English to Arabic number without changing any regional settings in .net

Well, most applications that I worked with was multilingual that supports English UI and Arabic UI.

And one of the major issue that we have faced is displaying Arabic numbers without the need of changing the regional settings of the PC.

So the code below will help you to display Arabic number without changing any regional settings.

Get pixel format, raw format, property id list and property items image in VB.net - C#.net.

n this simple article you will learn that how we can get pixel format, raw format, property id list and property items image in VB and C#.net.

Get Pixel Format:

Image consists of pixels to get the format of the pixel we have a property named pixel format. This property returns an enumeration of pixel format. This enumeration tells the pixel format.

To demonstrate make a window application. Drag one button and a picture box on form.

Now write the following code on Button click event:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend