Need Help Displaying A Fraction As A Decimal

Oct 15, 2007

 Hi,
 If you execute the following query in TSQL:

 
select 1/2
 
you will always get back zero.  I need a simple SQL statement that will return its  decimal equivalent (i.e. .5).   Can anyone give me a hint how to do this?
 
Thanks
 

View 3 Replies


ADVERTISEMENT

Split A Decimal Number Into The Integer Part And The Fraction Part

Dec 7, 2007

I have a table with a column named measurement decimal(18,1).  If the value is 2.0, I want the stored proc to return 2 but if the value is 2.5 I want the stored proc to return  2.5.  So if the value after the decimal point is 0, I only want the stored proc to return the integer portion.  Is there a sql function that I can use to determine what the fraction part of the decimal value is?  In c#, I can use
dr["measurement "].ToString().Split(".".ToCharArray())[1] to see what the value after the decimal is.

View 3 Replies View Related

Displaying Output In Decimal

Dec 22, 1999

Hi

Can anyone out there help me to solve the displaying floating point?

The problem is i couldn't get the result as 3.33333. The result i am getting is 3.00.

My coding is as below:
declare @a decimal(7,5)
select @a = 10/3

select @a
Result : a = 3.00

Thanks in advance

Rgds
Ave

View 1 Replies View Related

Decimal Not Displaying Correctly From Excel

Sep 6, 2007



I have an Excel spreadsheet with three columns of data, one of which is a "Score". The score will range between 1.0 and 0, going out to two decimal places. I am able to get this data into a global temporary table. I have a script in which a message box pops up, displaying the MIN value of the "Score" field in the temp table. The MIN value is .2. When I try to get the data from the temp table to a staging table, the Scores are all rounded to the nearest whole number. I think I've tried using every numeric data type for the staging table, and I always get the same results. In the temp table, Score is defined as such:


[Score] [decimal](18, 0) NULL


Does anybody know what I need to do to get the score to display acccurately?

Lindsay

View 5 Replies View Related

Why This UDF Return 0 Instead Of The Fraction?

Jun 7, 2007

ALTER function dbo.fr()
returns numeric(10,3)
as
BEGIN
RETURN 1/2 -- weird this returns 0
END





Thanks!

View 5 Replies View Related

Analysis :: Handle YTD With Per Month Fraction?

Jul 24, 2015

I want to calculate values for one of the measures on a YTD basis, but for each month there is a "factor" that varies between 0 and 1, varies throughout the year (value for each month) and the total for the 12 months will always add up to 1.  In other words, the standard YTD isnt enough.  The factor or weighting rises and falls throughout the year, so this has to be taken into account.

We have a "MonthFactor" table like this

FactorName
Month1
...
Month12

Where each of the MonthN fields holds the value mentioned before.  The measure in question, each record has a reference to the MonthFactor table.  So its value is actually "weighted" according to the factor in the MonthFactor table.  Ive seen references and mention of "Time Balancing" in various blogs etc, is this what Im describing?So, the YTD value would be a sum of each of the monthly values X the "month factor"

View 3 Replies View Related

Legacy Database Uses Decimal Data Types.--&> AutomobileTypeId (PK, Decimal(10,0), Not Null) Why Not Integers Instead ?

Sep 26, 2007

I am working with a legacy SQL server database from SQL Server 2000. I noticed that in some places that they use decimal data types, that I would normally think they should be using integer data types. Why is this does anyone know?
 
Example: AutomobileTypeId (PK, decimal(10,0), not null)

View 5 Replies View Related

Data Type With Decimal Point For Decimal Values But Not For Whole Integers

Dec 8, 2013

I am creating a table on SQL Server. One of the columns in this new table contains whole integer as wells as decimal values (i.e. 4500 0.9876). I currently have this column defined as Decimal(12,4). This adds 4 digits after the decimal point to the whole integers. Is there a data type that will have the decimal point only for decimal values and no decimal point for the whole integers?

View 2 Replies View Related

Cast Or Convert Nvarchar With Comma As Decimal Separator To Decimal

Apr 29, 2008

Hello.

My database stores the decimals in Spanish format; "," (comma) as decimal separator.

I need to convert decimal nvarchar values (with comma as decimal separator) as a decimal or int.


Any Case using CAST or CONVERT, For Decimal or Int gives me the following error:

Error converting data type varchar to numeric



Any knows how to resolve.

Or any knows any parameter or similar, to indicate to the Cast or Convert, that the decimal separator is a comma instead a dot.

View 5 Replies View Related

Converting (casting) From Decimal(24,4) To Decimal(21,4) Data Type Problem

Jul 24, 2006

Hello!



I would like to cast (convert) data type decimal(24,4) to
decimal(21,4). I could not do this using standard casting function
CAST(@variable as decimal(21,4)) or CONVERT(decimal(21,4),@variable)
because of the following error: "Arithmetic overflow error converting
numeric to data type numeric." Is that because of possible loss of the
value?

Thanks for giving me any advice,

Ziga

View 6 Replies View Related

How Can I Use The Decimal Comma Instead Of Decimal Point For Numbers In Jet Engine?

Sep 19, 2007



I wanted to convert a dataset from vb.net (2.0) to an .XLS file, by MS Jet. My national standard is using decimal commas, not decimal points for numbers signing the beginning of decimal places.
But the MS Jet Engine uses decimal point,in default. Therefore, in the Excel file only string formatted cells can welcome this data, not number formatted.
How can I solve or get around this problem? (with jet if it possible)
iviczl

View 4 Replies View Related

Converting Decimal To String W/O Decimal Point

Jul 23, 2005

I'd like to convert a Decimal value into a string so that the entireoriginal value and length remains intact but there is no decimal point.For example, the decimal value 6.250 is selected as 06250.Can this be done?

View 6 Replies View Related

Converting Decimal Point To Decimal Comma

Nov 30, 2007

Hi all,

I am designing some reports for a German branch of my company and need to replace decimal point with a comma and the thousand comma seperator with a decimal point.

e.g.
‚¬1,500,123.00 to ‚¬1.500.123,00

Is there a property that I can change in the report designer to allow this to happen or is this something I need to convert in a Stored Proc.

Any help would be much appreciated

Thanks!

View 5 Replies View Related

Decimal Limited To 4 Digits To Right Of Decimal?

Jun 18, 2007





I need to store decimal values: decimal(20,15) in my SQL Server 2005 database.

I load data from flat file, convert it using Data Conversion Task to decimal(with scale: 15) and try to save it using OLE DB Destination.



It works fine for 4 digits after the decimal (like 1.1234), but always failes for more than 4 digits (1.12345).

Is the decimal limited to scale 4 ???



Thank you for your help!

Anna





View 3 Replies View Related

Packed Decimal To Decimal Conversion

Jun 4, 2007

Hi,




I am having a file in which amount fields are given in a Packed Decimal format. Can anyone suggest me how I can read this data element from the file and convert it into SQL decimal datatype.

File is a fixed length. All the amount fields are given in Packed Decimal Format and rest of the fields are given in text format.
How can i identify and convert only those packed decimals using SQL/.Net.

Example : a row in a file that has some packed decimals
158203508540188236252EUR20BZK0030 Å“&
20060715 0001010100010101




Please help!



Thanks

Mirudhu

View 4 Replies View Related

Looping Through Stored Procedure Inside Another Stored Procedure And Displaying The Category And Then Displaying 1 Item In Each Category

Sep 21, 2006

I used to do this with classic asp but I'm not sure how to do it with .net.Basically I would take a table of Categories, Then I would loop through those.  Within each loop I would call another stored procedure to get each item in that Category. I'll try to explain, Lets say category 2 has a player Reggie Bush and a player Drew Brees, and category 5 has Michael Vick, but the other categories have no items.Just for an example.. Category Table: ID   Category1      Saints2      Falcons3      Bucaneers4      Chargers5      FalconsPlayer Table:ID    CategoryID   Player                 News                                Player Last Updated1            1           Reggie Bush       Poetry in motion                                9/21/20062            1           Drew Brees         What shoulder injury?                        9/18/20063            5           Michael Vick       Break a leg, seriously.                       9/20/2006 Basically I would need to display on a page:SaintsReggie BushPoetry in MotionFalconsMichael VickBreak a leg, seriously.So that the Drew Brees update doesnt display, only the Reggie Bush one, which is the latest.I have my stored procedures put together to do this.  I just don't know how to loop through and display it on a page.  Right now I have two datareaders in the code behind but ideally something like this, I would think the code  would go on the page itself, around the html.

View 1 Replies View Related

T-SQL ROUND(decimal, Int) Vs C# Round(Decimal, Int32)

Jan 30, 2006

Anybody noticed that SQL Server rounds up if the value is half waybetween two rounded values, but C#'s Decimal.Round(Decimal,Int32)rounds to nearest even number?[color=blue]>From MSDN: "When d is exactly halfway between two rounded values, the[/color]result is the rounded value that has an even digit in the far rightdecimal position. For example, when rounded to two decimals, the value2.345 becomes 2.34 and the value 2.355 becomes 2.36. This process isknown as rounding toward even, or rounding to nearest."I perform the same calculation sometimes on the web server in C# andsometimes at the database in T-SQL, but want to get the same resultfrom both calculations. Could anybody offer any strategies for dealingwith this?Thanks ~ Matt

View 3 Replies View Related

Displaying 0 In Int

Apr 25, 2007

This is what I'm trying to do:

If String AB06 is then I need to get AB05; if it is AB11 I need to get AB10.

My select statement looks like this:

select 'AB'+(cast(substring(period,3,2) as int)-1) from table.

Result is AB6. But I want AB06 (ABzero6)


But when I do this, I'm getting AB6 instead of AB06. Can someone please tell me how to have '0' in front of 6? I guess when I cast it as integer, it is ignoring the leading 0.


Thanks.

View 4 Replies View Related

Displaying % In Value

Oct 27, 2006

Hi

I am calculating percentage using expression. I want to display % at the end of the result.

If I use P1 or P0 somehow it multiplies the result with 100 I guess.

Here is what my calculated value is

15.384515

and I want to display 15.38%

Using P1 or P0 I am getting 1,538.5%

How can I get the desired result?

Any help would be appreciated.

Regards

Amit

View 5 Replies View Related

Displaying

May 7, 2008

Hi there

I got the following returned simple dataset as follow:






Code Snippet

ReportViewType; Category; Name; Units; Price;
LIST_VIEW; FRUITS; Apple; 1; $10
LIST_VIEW; FRUITS; Banana; 2; $11
LIST_VIEW; CARS; Corolla; 8; $100
LIST_VIEW; CARS; BMW; 10; $200

I've managed to grouped by Category field nicely and added extra calculated column for handling to total plus as well as Total for each group plus added a new row for TOTAL in the TABLE and returned as follow:





Code Snippet

FRUITS
Apple; 1; $10; $10
Banana; 2; $11; $22
TOTAL FRUITS; $32

CARS
Corolla; 8; $100; $800
BMW; 10; $200; $2000
TOTAL CARS: $3000


TOTAL: $3032

Now I want to put another extra row underneath TOTAL for handling the calculated but the business rule is only for displaying from the first group for instance:






Code Snippet

TOTAL: $3032



Calculated Average per fruits: $1010.67 ($3032 / 3 UNITS).

3 UNITS is coming from Units for Apple and Banana.

I don't know if I can do this cause i did try to use





Code Snippet

=SUM(IIF(Fields!Category.value = "FRUITS", Fields!Units.Value, 0))
But it's successfully compiled but the report result error (#Error) on that field only. Any ideas?

I thought a simple like this can be handled quite easily instead of creating a new report view type in the the same dataset to handle this particular extra line.

Waiting your comment/feedback.





View 4 Replies View Related

Displaying Results Of Map

Feb 16, 2008

I am trying to create a user permission system that is stored in a database.  What is the best table structure for accomplishing this?   How could I display the permissions in a grid?  Currently I have a users table and a permissions table.  I created a map between the two.  However, I don't see how this allows me to display a grid.  All my "columns" for permissions are actually rows from the permissions table. So ideally my grid would look something like this. User | P1 | P2 | P3 |A      | T   |  F  |  T  |B      | T   |  T  |  T  |Thanks for any help.  I am relatively new to SQL so please explain gently. 

View 2 Replies View Related

Displaying Images

Mar 16, 2006

Hi,
I am a new VWD user and have been trying to set up a website that allows 1 user to upload images into to SQL Express database and then display them with  a variety of other fields.
I have searched the forums, several books and many ASP "training" websites to find out how to do this. Every website seems to teach how to display a list of employees or show photo gallery, but none explains how to upload an image, save it in the appropriate field(s) in the database, and then display it when requested in a Datagrid or Details View using VWD and SQL Express 2005
Can any one give me directions to a solution, or send me a simple solution to this?
The best example of what I need is is a real estate listing, wherethe property for sale has 8 to 10 descriptive fields and 1 to 3 images that are displayed.
Any help would be appreciated.
Spacecaetrg.

View 4 Replies View Related

Reports Not Displaying

Jun 18, 2003

I have built an ADP for an internal project. The rpoblem I'm having is that one computer is not displaying reports. No matter who the user is it will not show the reports. I thought it might be a software issue/conflict, so I changed out the hardrive and started with a clean OS with only MS Office installed on it. I have also made sure that the users have access rights to SQL along with all sprocs used in the reports. But I'm still having the same problem. There are four other computers in the office that use the application and all work fine. If anyone has any ideas or suggestions I would be glad to hear them.

View 6 Replies View Related

Getting MAX Value And Displaying Record

Dec 2, 2004

Hi all,

I basically want to display the single row that has the highest 'jobid' using a SP. I was playing with MAX(jobid) but getting errors about no group by, etc. Where do I begin with this?


SELECT Purchord, JobNo, Descr, customer, jobid
FROM Jobs

View 4 Replies View Related

Tables Not Displaying In SQL

Dec 30, 2003

I am hoping someone can help me on this. I have lost the ability to see tables in one database. I can see views and have full access rights on this database. I was trying to install OLAP Analysis on my PC and suddenly I lost this capability on one of the databases I access. Any thoughts? I have looked at everything I can find trying to fix this. Have re-installed and even cleared my user and re-added. It is something on my PC alone since it also affects anyone who signs on to my box.

View 14 Replies View Related

List Box Is Not Displaying

Mar 30, 2004

I have a list box getting a filtered recordset from a stored procedure using ADO calling in VB6.
The recordset returns the two records with correct values. The problem is it is not displaying in the list box. Why? I tried using .additem property but it is not available in Access 2000. Can anyone help me with this?

Function ..
Dim rs_get_defect_desc As New ADODB.Recordset, lot_n as integer
Set lot_n = 4051

Rs_get_defect_desc.Open "EXEC spGet_desc_defect @lot_n=" & lot_n, CurrentProject.Connection
Do While Not rs_get_defect_desc.EOF

lstbox.RowSource = rs_get_defect_desc(0) & " " & rs_get_defect_desc(1)
rs_get_defect_desc.MoveNext

Loop

View 1 Replies View Related

Displaying Columns Twice

May 9, 2008

Hello All,

I have a little problem. Here is the scenario:

I got two tables Asset and Personnel

Personnel has FirstName, LastName,and username which is unique.

Asset table stores all information related to an asset and the username to whom the asset is assigned and the POC username.

The tables look like this:

Personnel Table
FirstName, Last Name, UserName
John, Doe, jdoe
Bill, Smith, bsmith

Asset Table
POCUserName, AssigneeUserName
jdoe,bsmith

My problem arises when I want to display First Name and Last Name for both the POCusername and the AssigneeUserName since FirstName and LastName columns exists once in the Personnel table. How can I display the columns twice. Lets say POCFirstName, POCLastName, AssigneeFirstName, and AssigneeLastName. Or this is something that can't be done.

The query below only display the Assignee info. Of course, I need to something else to display the POC info as well...don't where to go from here...

select tblPersonnel.FirstName, tblPersonnel.LastName, tblAsset.AssigneeUserName, tblAsset.POCUserName
from tblVendor, tblAsset, tblPersonnel
where and tblPersonnel.UserName = tblAsset.AssigneeUserName
and tblAsset.POCUserName in(select tblPersonnel.UserName from tblAsset, tblPersonnel
where tblPersonnel.UserName= tblAsset.POCUserName)

Any help is greatly appreciated

~
N

View 3 Replies View Related

Displaying The SP Script Using QA

Oct 21, 2006

Hi do u know what the shortcut or the code command to diplay an SP code in QA.
Instead of right clicking the SP in QA and clicking "Script object to New window as Create" is there a command or a shortcut that I can type using keyboard
Thank you

View 5 Replies View Related

Counting And Displaying

Jun 8, 2007

I need to add up the number of people who joined this month and compare that number to the number of people who joined last month and display the results in a report:

FirstName..LastName.....StartedDate
Randy......Simpson......5/4/2007 10:00:00 PM
Steve......Rowe.........5/2/2007 10:00:00 PM
Eric.......Dickerson....5/4/2007 10:00:00 PM
Gloria.....Sanches......5/1/2007 12:00:29 AM
Andres.....Marcelino....5/1/2007 12:06:31 AM
katie......ryan.........6/4/2007 12:08:35 AM
Denise.....River........6/4/2007 12:27:14 AM
Kellog.....Stover.......6/5/2007 12:37:20 AM
Glenn......Sanders......6/1/2007 12:42:40 AM

View 15 Replies View Related

Displaying A Table

Jul 23, 2005

I'm not sure how to go about this and need some help.I've got a data extract rather than a properly structure table in SQL.It looks something like below:Name: Item:John BallJohn RacketPaul BallJim GloveJim BallWhat sort of script can I run that will return each name once and thenthe Items in as many columns needed to list them all?I.e. so that it will look likeName: Item1 Item2John Ball RacketPaul BallJim Glove BallRegards,Ciarán

View 1 Replies View Related

ToolTip Not Displaying

Jun 28, 2007

What am I missing on the tooltip. I have entered a very simple if statement based on a parameter. Why will it not display with I run the report?



I have entered the simple formula in the tooltip under the fields textbox propeties. What am I missing.

=iif(Parameters!ExcelExport.Value = False, "No", "Yes")

View 6 Replies View Related

Displaying Reports

Nov 6, 2007

Hi

I want to use a hosting service that has ssrs capability. I am using asp to generate a website that's data driven by sql 2005. I want to know if it's possible to display the reports I've created to anyone on the web site with the use of URLs to the report rdl. Can this be done on an asp page or does it have to be an aspx page (.net)? It seems like this would be a very common application of sql and report services. Thank you for any help you can give me.

Philip

View 1 Replies View Related

Most Charts Not Displaying

Feb 28, 2007

I've got a report with a table holding a subreport that contains a number of Dundas charts. Each of these charts displays A LOT of data.

Now... after deploying the report, only a few charts at the bottom of the report are displayed -- the rest display the Image-doesn't-exist icon (File image with red X across it). Can anyone tell me what's going on? My best guess is that this is a memory issue on the server side...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved