Showing posts with label output. Show all posts
Showing posts with label output. Show all posts

Monday, March 26, 2012

how to show columns with two decimal places

HI ,

I've table whose output is some coumns. The colums show 6 digits after decimal point . My problem is i want to show only two digits after decimal point .. How to do using query..

Thanks

From your question i seem that you are having the FLOAT datatype. You can do this in two ways

1) Modify the table column to DECIMAL(10,2), if you always want to have results in the 2 deciaml place

or

2) SELECT cast (2.456576 AS decimal(10,2)), if you want temp. solution.

Note: This will Round-off the values.

Gurpreet S. Gill

|||

You can use the following approaches,

With Rounded Value:

select convert(Numeric(7,2),ColumnName) From TableName

here it will round/adjust your number to 2 digit decimal

Without Rounded Value:

Select Convert(Numeric(7,2), Round(ColumnName,2,1)) From TableName

here it will truncate the number upto 2 digit decimal and it only show the 2 digit dicimal on your output

|||

Two best practices:

1. The best thing to do is change the table to store the data as the datatype you want to use.

2. If the data needs to be stored like this, but you want to display it this way, the absolute best way of doing this is to use the front end to format the data as you want it. The front end already has to work to display the data in some format, so specifying it as you desire will be best

If you need to do it in T-SQL, then the other replies to use CAST is the next best thing.

|||Already my table datatype is fixed i can't change the datatype. I'm just show output in gridview ...Tell me something which can be done in Grid view or else i've change the whole datatype of table|||As suggested by others, i too says "the best place to do this is the FRONT END". As, when the front end read the data from Database, it internally converts the data into its readable form.

ok tell us which Language you are using & its version ?
which Grid ? and other information. like connection type ...etc.

Gurpreet S. Gill|||Hi i'm using asp.net Grid View (vb.net)|||This may help you
http://www.netomatix.com/development/GridViewDataFormatting.aspx

More reading regarding the "DataFormatString"
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring.aspx
http://devauthority.com/blogs/sskokku/archive/2006/08/17/1962.aspx

Gurpreet S.Gill|||More Reading
this the exactly what you want
http://forums.asp.net/thread/1463906.aspx
http://msconline.maconstate.edu/Tutorials/ASPNET2/ASPNET07/aspnet07-01.aspx

Gurpreet S. Gil

how to show columns with two decimal places

HI ,

I've table whose output is some coumns. The colums show 6 digits after decimal point . My problem is i want to show only two digits after decimal point .. How to do using query..

Thanks

From your question i seem that you are having the FLOAT datatype. You can do this in two ways

1) Modify the table column to DECIMAL(10,2), if you always want to have results in the 2 deciaml place

or

2) SELECT cast (2.456576 AS decimal(10,2)), if you want temp. solution.

Note: This will Round-off the values.

Gurpreet S. Gill

|||

You can use the following approaches,

With Rounded Value:

select convert(Numeric(7,2),ColumnName) From TableName

here it will round/adjust your number to 2 digit decimal

Without Rounded Value:

Select Convert(Numeric(7,2), Round(ColumnName,2,1)) From TableName

here it will truncate the number upto 2 digit decimal and it only show the 2 digit dicimal on your output

|||

Two best practices:

1. The best thing to do is change the table to store the data as the datatype you want to use.

2. If the data needs to be stored like this, but you want to display it this way, the absolute best way of doing this is to use the front end to format the data as you want it. The front end already has to work to display the data in some format, so specifying it as you desire will be best

If you need to do it in T-SQL, then the other replies to use CAST is the next best thing.

|||Already my table datatype is fixed i can't change the datatype. I'm just show output in gridview ...Tell me something which can be done in Grid view or else i've change the whole datatype of table|||As suggested by others, i too says "the best place to do this is the FRONT END". As, when the front end read the data from Database, it internally converts the data into its readable form.

ok tell us which Language you are using & its version ?
which Grid ? and other information. like connection type ...etc.

Gurpreet S. Gill|||Hi i'm using asp.net Grid View (vb.net)|||This may help you
http://www.netomatix.com/development/GridViewDataFormatting.aspx

More reading regarding the "DataFormatString"
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring.aspx
http://devauthority.com/blogs/sskokku/archive/2006/08/17/1962.aspx

Gurpreet S.Gill|||More Reading
this the exactly what you want
http://forums.asp.net/thread/1463906.aspx
http://msconline.maconstate.edu/Tutorials/ASPNET2/ASPNET07/aspnet07-01.aspx

Gurpreet S. Gilsql

Friday, March 23, 2012

How to setup Padding after clicking ToggleItem

I am trying to format the output result from a Recursive Group dataset.
The dataset is very simple with EmployeeID and ManagerID as recursive and
the latter being the parent id. Table structure is very simple with one
line on the detail level with EmployeeID, EmployeeName, ManagerName & Level
(using Level Function).
The report correctly returns all the records order by Level and Toggle by
EmployeeID. However, I would like to setup Padding when subsequent levels
show up after clicking the ToggleItem. Where would I set that up? Any
required scripts involved (iif...?). I would also like to setup different
color formatting for the different levels, and I assume it could be setup at
the same property setting as the Padding.
Much appreciated!
-Lawrenceyou could use Level() function to set padding and color.
For example, setting left padding to expression
=String.Format("{0}pt",Level() * 10) provides 10 points padding per level.
I would suggest using =Switch() for changing color:
=switch (Level() = 0, "Red", Level() = 1, "Blue", True, Nothing)
switch () takes a variable number of parameters in the form of (evaluation,
if true return, next evaluation ...)--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lawrence" <Lawrence@.discussions.microsoft.com> wrote in message
news:61F57876-20A5-4A81-94DB-3ABA16AD8053@.microsoft.com...
> I am trying to format the output result from a Recursive Group dataset.
> The dataset is very simple with EmployeeID and ManagerID as recursive and
> the latter being the parent id. Table structure is very simple with one
> line on the detail level with EmployeeID, EmployeeName, ManagerName &
Level
> (using Level Function).
> The report correctly returns all the records order by Level and Toggle by
> EmployeeID. However, I would like to setup Padding when subsequent levels
> show up after clicking the ToggleItem. Where would I set that up? Any
> required scripts involved (iif...?). I would also like to setup different
> color formatting for the different levels, and I assume it could be setup
at
> the same property setting as the Padding.
> Much appreciated!
> -Lawrence

Friday, March 9, 2012

Wednesday, March 7, 2012

How to set MS Access as Data Flow Destination

I can't seem to find a way to make the Data Flow Destination in a Business Intelligence Visual Studion Project output an MDB file for Microsoft Access.

Hi Bart,

Data flow destination can be used to output to MDB file for Microsoft Access.

In the OLE DB "Connection Manager: Select "Microsoft Jet 4.0 OLE DB Provider" for the Provider field.
Click on the "Browse" Button next for the "Database File Name" property and Select an existing Microsoft Access Database file. and close that window.

In the OLE DB Destination Editor - for the "Name of the table or the view" property click on "New" and it will show the table format for the imported table in access database.

Thanks,
Loonysan

|||

Yes - its possible.

In the "OLE DB Destination Editor" Window - Click "New" for OLEDB Connection Manager.
In the "Connection Manager" Window - Select "Microsoft Jet 4.0 OLE DB Provider".
Select an existing Access Database file using the "Browse" button for "Database File Name and close the "Configure OLE DB Connection Manager" window.

In the "OLE DB Destination Editor" - Click "New" for "Name of the table or the view" - it will show the table structure of the imported data. Make changes to the table / column names if required.

Clcik on "Mappings" and check the default mapping for the imported columns. Click OK.

You should be good to go from here

Thanks,
Loonysan