Format Output As Scientific Notation (was Sql 2000 Question)
Jan 29, 2005
SELECT membername, outputval
case when choice = 0 then outputval else null end as outputval
from MyDatabase
group by membername, outputval
how to format outputval:
if outputval < 40000
format outputval as:
5 - 5.78 - 6.9 - 6,778 - 4,567.8 - 12,456.78 - etc.
if outputval >= 40000
format it as a scientific.
View 1 Replies
ADVERTISEMENT
Jan 22, 2008
I've got some values stored in nvachar(255) field stored by mistake as scientific notation (eg 7.5013e+006 instead of 7501301) and I need to convert and update the field with normal entry, not scientific notation. Is there a way to do that?
View 6 Replies
View Related
Jul 23, 2005
HiWe've got some numbers stored as Reals which are returning values inscientific notation that we need rounded down to 3 digits to the rightof the decimal.ie 8.7499999E-2 needs to return 8.75.Round, cast, convert, formatnumber in the dts package all fail.Help!Thanks Moe
View 2 Replies
View Related
Oct 16, 2013
We sometimes have small values stored in a column with datatype of float like 0.000644470739403048 which is being converted to -5.8E-05. Perhaps that is OK to be stored in the database however I need the value in decimal format to use. (I'm using longitude values in google maps).
is there anything I can do at the database level. I was looking at the properties which is 53 numeric precision and 8 length.
View 8 Replies
View Related
Jul 20, 2005
I'm trying to find a way to format a FLOAT variable into a varchar inSQL Server 2000 but using CAST/CONVERT I can only get scientificnotation i.e. 1e+006 instead of 1000000 which isn't really what Iwanted.Preferably the varchar would display the number to 2 decimal placesbut I'd settle for integers only as this conversion isn't businesscritical and is a nice to have for background information.Casting to MONEY or NUMERIC before converting to a varchar works finefor most cases but of course runs the risk of arithmetic overflow ifthe FLOAT value is too precise for MONEY/NUMERIC to handle. If anyoneknows of an easy way to test whether overflow will occur and thereforeto know not to convert it then that would be an option.I appreciate SQL Server isn't great at formatting and it would be fareasier in the client code but code this is being performed as adescription of a very simple calculation in a trigger, all stored tothe database on the server side so there's no opportunity for clientintervention.Example code:declare @testFloat floatselect @testFloat = 1000000.12select convert(varchar(100),@testFloat) -- gives 1e+006select cast(@testFloat as varchar(100)) -- gives 1e+006select convert(varchar(100),cast(@testFloat as money)) -- gives1000000.12select @testFloat = 12345678905345633453453624453453524.123select convert(varchar(100),cast(@testFloat as money)) -- givesarithmetic overflow errorselect convert(varchar(100),cast(@testFloat as numeric)) -- givesarithmetic overflow errorAny suggestions welcome...CheersDave
View 3 Replies
View Related
Jan 10, 2008
Hi All,
Am I missing something or is there something odd with float data types. i know that float is not the most precise definition but i came across something really odd today.
first let me define the scenario.
this is sql server 2005, standard edition build 3042.
I have a table defined as
CREATE TABLE [dbo].[ASSET](
[Property_Num] [numeric](10, 0) NOT NULL,
[Accrual_Factor_Val] [float] NULL
)
the accrual_factor_val was updated to a value of 0.00005 then the web service failed because the proc returned 5E-05!
i opened the table, and discovered this is the stored value. is this correct?
thoughts and ideas?
thanks for your input!
View 5 Replies
View Related
Apr 25, 2008
Hi ,
I have one problem regarding format of mixed data columns in excel. I am using this query to retieve data from my excel spreadsheet
Select * from OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;IMEX=1;IHDR=yes;Database=E: est.xls;HDR=YES',
'SELECT * FROM [original$]')
to retrieve data from excel sheet.
I am able to retreive all data (numaric and text) , but for few cells I am getting wrong values.
like this
15106749310-> 1.51067e+010
70400672657-> 7.04007e+010
48110753143-> 4.81108e+010
registry setting are €œtext and 0€³. I am also using IMEX=1 in connection string.
I have numeric and text data both in same column,
eg:
70400503549
70400672657
KF1080420908
KF1260370908
KF1260880908
KF1260960908
Could you please help me to get the correct value from excel .
thanks in advance ,
View 7 Replies
View Related
Dec 5, 2006
Program Descritpion: Our product allows our customers to enter their product catalogs into our ASP.NET pages and we save the data using SQL Server 2005. Customer use GridViews to edit their data and teh data is broken into manageable groupings (called Field Groups) stored as meta-data in SQL Server Tables. Then when a user wants to edit a set of data they choose the Field Group and we dynamically generate a data source and a gridview, bind them together, and our users update their data. A bit more complicated but that's teh gist.
Another thing they can do, and where our problem occurs, is they can print reports or do exports into excel using this data. Since there are so many fields, they use the Field Groups to select which fields they want included so everything needs to be built dynamcially, at runtime, using the Field Group meta-data. Essentially, I want my grid to have these 10 fields.
Problem:For the export we generate an XML data source using FOR XML in SQL Sprocs. The xml is pulled into a xmldatadocument, trasnformed with an xsl file into an Excel XML Spreadsheet. Our problem is that FOR XML is generating our XML real numbers in scientific format. The xsl "format-number" function does not recognize scientific format and returns NaN (not a number) instead of the value in my spreadsheet. If I leave it blank I get the scientific number but Excel doesn't format it correctly, the cell has an error tag that wants me to choose Number stored as text or convert to a number. I need it to show up on teh Excel form already formatted without that message.
I can't change the DataType of the field in SQL, too many other things depend on it and it needs to be a real. I can't use CONVERT(decimal,fieldName) in SQL because the SQL string is dynmically generated using Dynamic SQL and most of the fields are not real. When we build the Field List we just have field names, we can't check anything to add CONVERT functions to only real fields.
Is there any way to force the XML output to not be scientific for the entire document? Or another function in XSL I'm unaware of (pretty new to xsl)? Or perhaps something I can do in the XML Spreadsheet tags to force the conversion?
View 1 Replies
View Related
Aug 19, 2015
I have created SSRS report which has many overlapping objects, the output in PDF format seems to good but in word format it is not giving the required output.
View 5 Replies
View Related
Dec 9, 2004
Hello everyone:
There is query output like:
1
2
3
4
How to specify it to be like"
1,2,3,4
?
Thanks
ZYT
View 1 Replies
View Related
Jun 12, 2002
Hello All,
I am new to SQL Server. I would like to know how to format output using isql on SQLServer7.0
e.g.
I want this selection
CUST_ID CUST_NAME CUST_TYPE ADDRESS
----------- ----------- ----------- -----------
1 CUST 1 CREDIT RISK ADDRESS1
1 CUST 1 CREDIT RISK ADDRESS2
2 CUST 2 GOOD ADDRESS1
2 CUST 2 GOOD ADDRESS2
2 CUST 2 GOOD ADDRESS3
3 CUST 3 BAD ADDRESS1
to display like this
CUST_ID CUST_NAME CUST_TYPE ADDRESS
----------- ----------- ----------- -----------
1 CUST 1 CREDIT RISK ADDRESS1
ADDRESS2
2 CUST 2 GOOD ADDRESS1
ADDRESS2
ADDRESS3
You are help will be much appericated.
Thanks & Regards
Nitin.
View 1 Replies
View Related
Oct 25, 2007
Using sql server
I want to create a txt file from a table i have. I have the data in the correct formats but i want to include some padding around my selected four columns.
Im not sure about the best way to go about this?
View 1 Replies
View Related
Apr 5, 2007
Hi,
I have the following problem.
I have made a parametered report where i ask a begin date (@datefrom) and an end date (@dateto).
when i enter my dates via the little calendar is see the format dd/mm/yyyy
When i do a preview of report i have a textbox with the following expression :
="Total work time from " & Parameters!DateFrom.Value & " to " & Parameters!DateTo.Value
but the output of the date format is mm/dd/yyyy.
What can i do to have the output format dd/mm/yyyy
Vincent
View 4 Replies
View Related
Aug 9, 2007
I am trying to format the result output from my query so that it looks like currency. Does anyone know how to do this?
Here is my very simple select statement:
SELECT Field_Value
FROM tbl_all_results
I was thinking some kind of cast/convert would do the trick but I can't seem to get anything to work.
Thanks for your help!
View 5 Replies
View Related
Aug 29, 2007
In my report I have used the "jump to url" for the report output but when I export this to excel I get a column with the correct data and also the url.
Is there anyway of exporting the data without the url?
I want my users to be able to view the report and click on the column the want to URL jump to but also be able to export just the raw data without the URL?
View 5 Replies
View Related
May 21, 2008
Month NoofAttendanceDays NoofPresentDays
January 25 20
Febrauary 23 21
March 26 20
April 24 21
Thanx in Advance
View 3 Replies
View Related
Jun 4, 2008
I have the following Query which gives the output in XML format.
select * from <Table_Name> For XML auto
I wanted to store this output in a .Xml file at my local machine.
I would prefer to have a proc when called generates the xml and stores it on the local m/c. Any ideas ?
Thanks,
View 3 Replies
View Related
Dec 6, 2004
I manually build my url for my reports. In the url I build, I can specify the output format I would like it to automatically use when the report opens. However, it always first opens the dialog box to either Save, Open, or Cancel. Is there anyway to bypass this and just open it in the format I have coded in the url? Thanks.
View 2 Replies
View Related
Sep 19, 2001
Hi Kids,
I've just upgraded a 6.5 database to version 7.0 and I'm having a problem with default date output formats.
Under 6.5 the output format was: Sep 2 2001 12:00PM
Under 7.0 the same field is output as: 2001-09-02 12:00:00.000
Is there a way to permanently set the default output format for dates on a database or server wide?
Thanks
Ron
View 1 Replies
View Related
Jun 8, 2004
Has anyone had experience formatting an excel file (i.e. run a macro) after it is (created &) outputted from a DTS package?
Also an easier question:
What is the best (easiest) way to create a unique filename in Excel with a datetimestamp in the file name (i.e. MyFile-20040608.xls)
Thanks!
View 3 Replies
View Related
Dec 12, 2014
I have sample data like 'J.S.xxxx','J.xxxx.'
Want to separate the . in the middle of word with single space and display results in following way.
J. S. xxxx
J. xxxx
Need the code in optimized way.
View 3 Replies
View Related
Jun 7, 2006
Hi All,Currently the query returns 2006-03-27 00:00:00, can I make it output03/27/2006, I want to truncate the time, and replace the hyphens withforward slashes. Any ideas?Thanks In Advance,~CK
View 6 Replies
View Related
Mar 14, 2007
A few details first:
The report server is remote to the development server (VS 2003).
The web application that will be calling it is ASP.NET 2.0 and developed in VS 2005.
I have a couple of questions:
a: Can I link to the report from the web application using a basic Hyperlink control rather than using a ReportViewer control?
b: How can I force which format it opens in? Say I want it to be rendered as a PDF in one instance but at an XSL document in another.
Many thanks and kindest regards,
TwoForTea
View 1 Replies
View Related
Sep 23, 2005
Hi all,
I'm Trying to replicate the creation of an "xml" file that is currently created using a C++ application. I want to take that application out of the picture, but need to create the same format XML file because a step later in the production process uses this file, and I cannot change it.
The output format I am looking for is:<?xml version="1.0" encoding="utf-8"?>
<FUNDS>
<AMRGX>
<NAME>AMERICAN GROWTH D</NAME>
</AMRGX>
<AHERX>
<NAME>AMERICAN HERITAGE FUND</NAME>
</AHERX>
<AMRVX>
<NAME>AMERICAN INVESTORS GROWTH FUND</NAME>
</AMRVX>
.
.
.
</FUNDS>The problem I am having is that I cannot seem to get the level/node of the fund symbol (AMRGX, AHERX, and AMRVX in the example above) as it needs to be. I think this must be some non-standard use of XML, since the tag is really the data itself (?)
The closest I have been able to get so far is:
<FUNDS>
<SYMBOL>AMRGX</SYMBOL>
<NAME>AMERICAN GROWTH D</NAME>
</FUNDS>
<FUNDS>
<SYMBOL>AHERX</SYMBOL>
<NAME>AMERICAN HERITAGE FUND</NAME>
</FUNDS>
.
.
.As you can see (hopefully) I am able to get the data I need but cannot get:
(1) the FUNDS tag(s) to be the very highest level/root.
nor (2) the SYMBOL part (tag label?) to be the actual variable stock fund.
Am I 'splaining this well enough? I don't necessarily need all the code, since I know I haven't given enough info to help with that, but my basic question is - - Is it possible to get a variable TAG based on the table DATA?
I want my SYMBOL tag to be the actual SYMBOL for the stock fund.
Confused? Not as much as I am *LOL* I am new to the use of all but XML EXPLICIT use, so any help would be appreciated - at least regarding my two formatting questions.
Yes, I have (and am still) searching around BOL for my answers, but so I have found nothing that helps me out. Meanwhile, suggestions are welcome!
Thanks!
View 6 Replies
View Related
Feb 28, 2014
I have the following code and the result set is coming out as nvarchar. So, when I create a report in SSRS, it is not formatting as a date.
, CASE
WHEN isnull(cv2.Accepted,0)='True' AND cv2.Visit ='V2' AND cv2.StepNo='3' THEN 'Y'
ELSE CONVERT(varchar,[dbo].[fn_Get_WorkingDays] (co.PlannedGoLiveDt, -10))
END AS 'System Verified'
View 3 Replies
View Related
Feb 8, 2007
Hello folks,
A while back I wrote a .NET assembly with a COM wrapper to provide an interface between Report Services and legacy MS Access applications. Basically, it returns the byte arrays from the .render method (output format emf) to be written into an Access image control.
This worked flawlessly on any 8.5"x11" RS report we threw at it on the first two Report Services I tried it against. When we set up a third Report Service at another facility, the same reports were coming out with the physical dimension metrics on the emf as10"x13", so the Access version of the report is clipped significantly on the edges.
I trapped the output into a System.Drawing.Image object in the .NET assembly and put a watch on it. The two servers that work as I expected show HorizontalResolution and VerticalResolution as 96.0946, while the one that doesn't has these values as 81.2799. The PhysicalDimension property shows 21542.3672 x 27939.4316 on the working servers and 25531.25 x 33031.25 Otherwise, the properties of the images seem to be identical. The PhysicalDimension values I see are completely consistent with the size units of 0.01 mm, as the the emf documentation indicates. The resolution of 96 is consistent with the "Windows default" values of 96 dpi. The ratio of the resolutions is correct for an 85% scaling factor for the "misbehaving" Report Service.
I have not been able to find any reason for the differences between the Report Services, and I have not been able to figure out how to control it. I tried setting DpiX and DpiY as 96 in the DeviceInfo for the render call with no change in the behavior of either server.
Can anybody enlighten me on what is happening and what I need to do to get consistent behavior between the servers? Or why the DpiX and DpiY settings for the emf rendering extension don't seem to work?
Thanks,
Tim Bailey
Energy Laboratories, Inc.
View 4 Replies
View Related
May 16, 2013
I am trying to output a number in a specific format. I am playing with CAST() and CONVERT() but have not been able to get what I need.
Current: 0.019891
Desired: 000199
It doesn't have to remain in a number format, as i will be output to a CSV in order to bulk load into another system.
View 4 Replies
View Related
Aug 19, 2015
I have a table Test123 having three column EmpID,AttribName,AttribValue.
run the below query to generate table structure and data.
Create Table Test123(EmpID int,AttribName varchar(50),AttribValue varchar(50))
insert into Test123 values(1,'Name','X')
insert into Test123 values(1,'Age',50)
insert into Test123 values(1,'Salary',1000)
insert into Test123 values(2,'Name','Y')
insert into Test123 values(2,'Age',30)
insert into Test123 values(2,'Salary',2000)
insert into Test123 values(3,'Name','Z')
insert into Test123 values(3,'Age',35)
insert into Test123 values(3,'Salary','One Hundred')
And I want output in below format.
AttributeValueType
=================
AGE | NUMERIC
NAME | ALPHABET
SALARY | ALPHANUMERIC
==================
View 6 Replies
View Related
Apr 17, 2014
I need to display the output of a table in a specific format, I have attached the sample screenshot and code for reference.
I tried with pivot but does not seems to be working.
View 2 Replies
View Related
Mar 23, 2015
I am working on a code that will convert the query output into a html query output. That is the output of the query will be along with html tags so that we can save it as a html file.
The stored procedure that i have used is downloaded from symantec website and is working fine. Below is the code of that stored procedure.
/****** Object: StoredProcedure [dbo].[sp_Table2HTML] Script Date: 12/21/2011 09:04:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_Table2HTML] (
@TABLENAME NVARCHAR(500),
@OUTPUT NVARCHAR(MAX) OUTPUT,
[Code] ....
The code works fine and i am able to get the output with html tags. The problem occurs when i insert stylesheet in the code. I tried to enforce styles using a stylesheet for the table returned in my sql code, so that it will look good. below is the stylesheet code that i inserted between <head> and </head> tags.
<style type="text/css">table.gridtable { font-family: verdana,arial,sans-serif; font-size:10px; color:#333333;border-width:1px; border-color: #666666; border-collapse: collapse; } table.gridtable td {border-width: 1px; padding: 8px; border-style: solid; border-color: #666666; background-color: #ffffff;}</style>
If I run the procedure without the style sheet code, it works fine. but when i run the procedure with style sheet code i am getting the below errors.
Msg 105, Level 15, State 1, Line 98
Unclosed quotation mark after the character string '</table></body><'.
Msg 102, Level 15, State 1, Line 98
Incorrect syntax near '</table></body><'.
[Code] .....
I checked the code and i am not able to find what is the mistake. I tried changing the quotation mark but it didn't worked.
View 6 Replies
View Related
Dec 1, 2007
I'm not a professional dba or dbd, but I'm proficient in the basics ofdatabase design and sql. I want to create a database of mathdefinitions, and I'm wondering how one would go about creating adatabase that contains mathematical notation (and I'm not just talkingabout basic symbols where I could get away with ascii code). I needto be able to insert a wide variety of mathematical expressions, fromfractions to integrals, into fields (just like you can enter in-linemath symbols in MS Word using equation editor). I have no clue how togo about this. Is it a matter of developing certain programmingskills/languages? Would such a capabliltiy be proprietary (dbms-specific)? Is it possible at all? Any help would be appreciated.Thank you.
View 3 Replies
View Related
Mar 16, 2014
i m creating one google map application using asp.net with c# i had done also now that marker ll be shown from database (lat,long)depends on the lat,long i wanna display customer,sales,total sales for each makers in html table format.
View 2 Replies
View Related
Dec 14, 2007
Hi,
I am new to SQL 2005. I have to design schema for scientific data warehouse. Data is available in 2 or more flat data files recorded at 1 sec interval. At Least 2 of the data files have 100+ columns. I am inclined to create a table per data file type. I want to know If this is correct/optimal for me to do?
I don't think I can create normalize tables based on the headers in these Data files.
Primary Objective of this data warehouse is make it available for reporting services and Analysis Services.
Any suggestions or tutorials for me?
Thanks,
Vinod Kushwaha
View 1 Replies
View Related