Import Lots Of Decimals, Problem On The 18th

Dec 20, 2006

Hello,

I'm trying to import data from an Excel sheet into a table. Not all of them is imported.

Exl: 0,000801054857569349 becomes
Sql: 0,000801054857569350 when it is imported.

The column in SQL-Server is defined as DECIMAL 28.18, should take all 18 numbers i thought. Tried 28.19 also but it only added another zero at the end.

I've tried importing via DTS and manually import,same result both times.

Any suggestions?

View 6 Replies


ADVERTISEMENT

18th Occurance Of ; In A Field

Mar 20, 2008

Is there a simple command to find the 18th occurance/position of ";" in a field and I need to do this in the SQL code.

I can use charindex to find the 1st position and I can write a function to keep chopping off the data at the start of the field until I get to the 18th occurance but it takes 18 lines or so of code.

Is there a simpler way of doing this?

I need to find the 18th occurance of ";" and then take the next 4 characters.

View 4 Replies View Related

Bcp And Decimals

Oct 25, 2000

I am trying to use bcp to load a text file into SQL Server 7. The decimal numbers in the text file are formatted as 123455 and when I load the values to SQL I want the last two digits to be the decimal 1234.55. My current process is loading the value as 123455.00. What do I need to do in the format file to get this to work???

View 2 Replies View Related

Help With Decimals

Feb 22, 2004

Hi all,
This is what I have:
DECLARE @OnTime int
DECLARE @UnControlled int
DECLARE @Volume int
DECLARE @GrossEffect decimal(10,2)
DECLARE @NetEffect decimal(10,2)
DECLARE @WeekEndDate datetime

SET @OnTime = (SELECT COUNT(DataID) FROM tblEDITempARS WHERE OnTimeFlag = 1 AND ARSScanType = 'D' AND ARSType='AN')
SET @UnControlled = (SELECT COUNT(DataID) FROM tblEDITempARS WHERE ControlFlag = 'U' AND ARSScanType = 'D' AND ARSType='AN')
SET @Volume = (SELECT COUNT(DataID) FROM tblEDITempARS WHERE ARSScanType = 'D' AND ARSType='AN')
SET @GrossEffect = (@OnTime/@Volume * 100)
SET @NetEffect = ((@OnTime + @UnControlled)/@Volume * 100)
SET @WeekEndDate = (SELECT DISTINCT WeekEndDate FROM tblEDITempARS)

INSERT INTO tblSummaryData2(ReportType, Volume, NetEffect, GrossEffect, WeekEndDate)
VALUES ('AN',
@Volume,
@NetEffect,
@GrossEffect,
@WeekEndDate)

My numbers are:
OnTime=8089
Uncontrolled=6
Volume=8095

The GrossEffect comes as 0 and the NetEffect=100
AN809501002/21/2004

Why is my GrossEffect = 0??? it should be 99.9

View 1 Replies View Related

Help With Decimals

Feb 19, 2008

Hello, I have a table with a field with the format of 8 decimals. When I make a select to that table instead is given me (for example) 25,00 it gaves me 25,00000000. How can I fix the with the correct format? Thanks in advance.

View 2 Replies View Related

Decimals In SQL Server

Jul 7, 2005

I need to display decimal results from SQL Server queries, but the decimals keep getting truncated. For example, 9 divided by 4, keeps getting truncated to 2. Does anyone know how to display the whole result, including the decimals?

View 2 Replies View Related

Trimming Decimals

Aug 17, 2005

I have a field in my SQL table that is defined Decimal(10,8), which
provides me with the ability to have up to 8 digits after the decimal
place, however, if I store a value such as 3.14, it is stored as
3.14000000. This is fine in the database, but it is the same when it's
returned. I have tried using Convert.ToDecimal on my returned row but
it doesn't work. The value at runtime appears as 3.14D in the locals
window but displays with all the insignifcant digits.

Any ideas what's happening or if there is an easy way to trim the trailing zeros?

View 2 Replies View Related

Decimals In View

Aug 24, 2004

Hello,

I want a view to always present my numeric fields with 2 decimals. In my table I have the following values in field "amount" (numeric(18,2))

181.25
176.5
170

I want the view to show
181.25
176.50
170.00

I have tried Cast but that doesn't seem to do the job.

Help!

Rolf

View 1 Replies View Related

No Decimals In Query

Jun 24, 2008

in quantity column - i have

100.00000

but i want only 100

no decimals..

how to get that?


thanks

View 2 Replies View Related

DECIMALS IN QUERY

May 31, 2007

I have two fields whose format in the table is decimal (14,5).
I now have to divide one field by the other, and I want the result
to be in the format decimal (21,16).
Whatever I do I'm not able to get this result with sixteen decimals.
I tried with dec(Field1,21,16)/Field2 but it yields six decimals.
I tried with dec(Field1,21,16)/Field2 but it yields an integer.
I tried other ways but I always get a result which is made of maximum
six decimals.
What can I do?
Thank you.
Anna - Verona (Italy)

View 5 Replies View Related

Truncated Decimals

Jan 16, 2006

I am relatively new to SQL server. I am tring to send some decimalvalues to the database using a stored procedure with parameters of typeDECIMAL. Every time it inserts the values into the database thedecimals are truncated. I saw on the MSDN library that you have to setthe precision and scale values b/f you run the stored procedure. So Iset the precision to 8 and the scale to 4 and it still didn't help. Cananyone help me?

View 6 Replies View Related

Please Help! I Have Lots Of Questions.

May 6, 2007

In case some of you have read my previous posts, you may be aware that I'm writing a webboard application as a replacement for the old one.The old one currently have approximately 50000 topics in the database, each has on average 10 replies (I just check recently. I though it was only 7000 topics).I need to provide paging and sorting feature to the topic list. But I can't just SELECT all of them and let GridView do the paging/sorting, right?I have been using stored procedures to store my SQL statement for several projects now. I know how to deal with the paging feature (ROW_NUMBER), but the sorting requires me to change to change the "ORDER BY" clause.1. Can somebody tell me how to change the ORDER BY clause in the stored procedure(s) at runtime? Or does anyone have other approach?
Currently I'm thinking about moving back from store procedures to hard-code SQL statements, and then modify/generate the SQL statement for each paging / sorting. But I've learn that stored procedures give more performance and security.2. According to the situation I provided, is it worth moving from stored procedures to hard-code SQL?I'm also using 3-tier architecture approach + OOP. But I reach a conflict in my thoughts. You see, according to OOP, I'm supposed to create classes that reflect the actual objects in the real-world, right? In my case the classes are "Board, Topic, Reply, ...." According to this and 3-tier approach, I intend to use ObjectDataSource as a bridge between Presentation Logic and Business Logic. But I wonder what my datasource class should return3. Should my data source class return data objects like1st approach[DataObject(True)]pubic class TopicDataSource{         public static Topic[] GetTopicList() { }}or should it return DataSet / DataTable / DataReader like2nd approach [DataObject(True)]public class TopicDataSource{          public static DataTable GetTopicList() {}}Personally I think approach 1 is more OOP and allow for more extendability, but approach 2 might be faster.4. If I go with approach 1, how should I control which property of my data objects is read-only after it's has been inserted/created? Can I just set my data object's property to be readonly? Or do I have to set it at page level (i.e. GridView-> Columns -> BoundField -> ReadOnly=True)? Or do I set it and the page level and write a code to throw an exception in the rare case the application / user try to change it's value? Or else?Please help. These questions slow me down for days now.If there's any concepts that I misunderstood, please tell me. I'm aware that I don't know as much as some of you.I will be extremely grateful to anyone who answer any of my questions.Thanks a lot.PS. For those who think my questions are stupid, I'm very, very sorry that I bother you.

View 3 Replies View Related

Do Lots Of COUNTs

Sep 19, 2006

Hello :)

I seem to have somehow got myself into a situation where I'm having to run the following SELECTs, one after another, on a single ASP page. This is not tidy. How can I join them all together so I get a single recordset returned with all my stats in different columns?

SELECT COUNT(*) FROM tblQuiz WHERE [q3] = '5 years +' OR [q3] = '2 - 4 years'
SELECT COUNT(*) FROM tblQuiz WHERE [q4] <> '' AND [q4] IS NOT NULL
SELECT COUNT(*) FROM tblQuiz WHERE [q5] = 'Unhappy'
SELECT COUNT(*) FROM tblQuiz WHERE [q6] = 'Yes'
SELECT COUNT(*) FROM tblQuiz WHERE [q7] = 'Yes'
SELECT COUNT(*) FROM tblQuiz WHERE [q8] <> '' AND [q8] IS NOT NULL

View 8 Replies View Related

Lots Of Queries For My Db

Jul 20, 2005

Hello all,I have a database in SQL Server that should save data from a CRM-likeapplication.The database consists of tables like products, services, customers,partners etc. Problem is that the users should be able to find theseitems on different properties and with or without substring finding(SQL: LIKE). Example: I want the users to be able to find a customer,providing a customerID, but also providing a customername, zipcode orjust a part of those strings.This will result in a lot of queries. I bet there are some nicesolutions to this, since I will not be the first with this situation.If anyone can help, please.Thank you in advance.Regards,Freek Versteijn

View 3 Replies View Related

Decimals With Sum Agregate Function

Feb 23, 2001

I'm using the sum() agregate function inside a select with a decimal field with an scale of 2.
I want to get the result always with 2 decimals, but if the result is 100.10 I get 100.1 . I've tried
to convert and cast the result but I can't find how to get 2 decimals. Please help. Thanks

View 1 Replies View Related

Updateing DECIMALs With DB-Library

Aug 18, 2004

Hello,

I have encountered a problem doing an update on a Field defined as DECIMAL with dbcursor().

I have opened a cursor with dbcursoropen() with option LOCK_CC set. Then I have bound some char variables to CHAR Fields with STRINGBIND and some double Variables to the DECIMAL fields with FLT8BIND.

When I read the cursor, the data is correct in the bound variables. But when I do an update, all data for the numeric fields are gone and the database contains only NULL Values. The Strings are updated correctly.

I have tried to set the length, I am using the poutlen-variables with a value other than 0, but nothing helps.

Does anyone have an idea about what can I do?

Thank You in advance.

Frank

View 3 Replies View Related

How To Add Trailing Zeros 2 Decimals

May 18, 2008

In my select query for field ordernumber want to add two trailing zeros in the resultset, how can i add.

Thanks for the info.

View 1 Replies View Related

How To Add Trailing Zeros If There Is No Decimals

May 19, 2008

How can i add two trailing decimals if there is no decimals:

for example if it is just 1, then make it 1.00

if it is 1.12 then leave it as it is.

can you please help.

select cast(ordernumber as varchar(10)) + '00' from ordertable

Thanks for the info.

View 1 Replies View Related

Doubt In Truncating Decimals..

May 22, 2008

Hello

I need a help ..
I need to convert 45.4593251 to 45.46

How to achieve it.
Can any one help me please..

Thanks
Ganesh

Solutions are easy. Understanding the problem, now, that's the hard part

View 3 Replies View Related

Problem Saving Decimals

Nov 10, 2005

I want to save a decimal in my sql table. It's an hourly rate. I have my field as smallmoney type. I am updating the table using a sp from my web page. It always rounds my entry up eg 3.75 becomes 4.00. Heres my sp and the line where I am passing the parameter to the sp.

CREATE PROCEDURE spRB_AmendRoomData

@strRoomId int,
@strRoomRef nvarchar (50),
@strFloor nvarchar (50),
@strZone nvarchar(10),
@strLocation nvarchar (100),
@strType nvarchar(50),
@strNo int,
@strDirections nvarchar(2000),
@strPhoneNo nvarchar (50),
@strMaxNo int,
@strEquipmentFac nvarchar(2000),
@strNotes nvarchar(2000),
@strCharge smallmoney,
@strNotInUse bit,
@strIntExt nvarchar(20)


AS
BEGIN
UPDATE tblRB_Rooms SET

RM_RoomRef=@strRoomRef,
RM_Floor=@strFloor,
RM_Zone=@strZone,
RM_Location=@strLocation,
RM_Type=@strType,
RM_No=@strNo,
RM_Directions=@strDirections,
RM_PhoneNo=@strPhoneNo,
RM_MaxNo=@strMaxNo,
RM_Equipment_Facilities=@strEquipmentFac,
RM_Notes=@strNotes,
RM_Charge=@strCharge,
RM_NotInUse=@strNotInUse,
RM_IntExt=@strIntExt


WHERE
RM_RoomId = @strRoomid

END
GO


Cmd.Parameters.Add(New SqlParameter("@strCharge", Me.txtCharge.Text))

Thanks for any help

View 4 Replies View Related

Find Number Of Decimals

May 14, 2008

Can someone suggest a FAST way to select Currency values where the number has more than X decimal places? There are zillions of rows so looping in code is not the preferred solution.

(a bug forgot to round)

Thanks for your help

View 4 Replies View Related

Need An Expression Format To Put Decimals .00

Mar 27, 2007

I have the following field(Fields!SequenceNO.Value), coming form database.

i would like to have an expression IIF...



if the value coming from database is just 1, then make it 1.00 or

if the value coming from database has a period or point say 1.01 then show as it is.



thank you very much for the help / information....

View 1 Replies View Related

Transact SQL :: Two Decimals Multiply Each Other Become Zero

May 18, 2015

Script as follows :

select cast( 0.0050000000 as decimal(38,23)) * cast(0.0000010000 as decimal(38,23))
select cast( 0.0050000000 as decimal(28,23)) * cast(0.0000010000 as decimal(28,23))
select cast( 0.01 as decimal(28,15)) * cast(0.0000000001 as decimal(28,15))
select cast( 0.01 as decimal(28,16)) * cast(0.0000000001 as decimal(28,16))

The result was following:

0.0000000--was zero
0.000000005000000000000000000
0.00000000000--was zero
0.0000000000010

View 3 Replies View Related

Problem Rounding Decimals

Apr 15, 2008

Hi,
Im having a decimal value of 1.24
im rounding off the value to 1 precision
ex:- select round(1.24,1)
the output its returning is 1.20
i want to get only 1.2
can anyone suggest on this??

View 3 Replies View Related

Deleting Lots Of Records

May 21, 2004

Apparently, deleting 7,000,000 records from a table of about 20,000,000 is not advisable. We were able to take orders at 8:00AM, but not at 7:59.

So, what's the best way of going about deleting a large number of records? Pretty basic lookup table, no relationships with other tables, 12 or so address-type fields, 4 or 5 simple indexes. I can take it down for a weekend or night, if needed.

DTS the ones to keep to another table, drop the old and rename the new table?
Bulk copy out, truncate and bring back in?
DTS to text, truncate and import back?
Other ways?

Never worked with such a large table and need a little experienced guidance.

Thanks for the help

View 1 Replies View Related

SQL Performance- Lots Of Little Tables Or One Big One?

May 25, 2004

I am planning an application where ~1000 companies will be accessing data. Should I use a key to identify the company and place all data in one table i.e (WHERE company =123) or should the application create company specific tables i.e should I have 1000 small tables with 100 records in each, or one table with 100,000 records?

View 2 Replies View Related

Does Sql Server Slow Down If It Has Lots Of Db's?

May 7, 2008

Hi,

You know how there are lots of hosted applications out there, many of them provide you with your own database (not shared).

1. If a server has 1K databases on it, will this slow down the server just due to the # of databases? (each user has their own database, but they won't be accessing it that much really).

A seperate database is required for security purposes usually.

2. Can you still open up EM with 1K+ databases?

View 3 Replies View Related

Lots Of Transactions, But No Activity

Jan 30, 2007

Hi all,

I have a strange situation. Performance monitor shows that SQLServer:Transactions Transactions value is 125, but SQL Server Profiler does not show any activity.

I ran sp_who2 and I have a bunch of processes with SUSPENDED status. Would those be counted in Performance monitor?

When does a transaction get suspended?

Thanks.

Alec

View 1 Replies View Related

Trying To Restore Having Lots Of Troubles....

Sep 20, 2007

I used MS SQL Server Management Studio Express to back up my SQL Server 2005 database called "PMDB" on a server in my office to a jump drive. Then, I removed the jump drive from the server and plugged it into my laptop. I then tried using MS SQL Server Management Studio Express to restore "PMDB" to my laptop SQL Server 2005 Express Edition (instance "Primavera") to a database called "pmdb$primavera". I've had several issues:

1. pmdb$primavera is now "locked up" "in the middle of a restore". I can't seem to unlock it even by rebooting my laptop.
2. when I execute the restore (I've used several command sequences...) I get a message that there are additional "families" restore is waiting for. I don't understand that.
3. I tried restoring to a completely new database (in the same instance...), but got the "family" problem. The query just hangs forever. When I cancel it, it hangs the database (see #1).
4. I now have two databases in the "Primavera" instance on my laptop in the "restoring" state. I can't get to either one of them.

I'm desperate. I have a customer presentation on Thursday where I must have the database working. Help!

Here's one of the queries I executed.... though I tweaked items here and there for 3 and 4 above.


restore database pmdb

from disk='f:databasebackupPMDB-BAK.BAK'

with recovery,

move 'pmdb_Dat' to 'C:Program FilesMSSQLPrimaveraMSSQL.1MSSQLDATApmdb$primavera_DAT.MDF',

move 'pmdb_log' to 'C:Program FilesMSSQLPrimaveraMSSQL.1MSSQLDATApmdb$primavera_LOG.LDF'

go



The issue seems to be #2 above each time.

View 4 Replies View Related

SS2005 Log Has Lots Of These Messages.

Nov 14, 2007

Every time a transaction log is dumped we see the following message in the log file:

BackupDiskFile:penMedia: Backup device '\s-sqlbkups-1g$myserverlogmy_databasemydatabase_backup_200711071430.trn' failed to open. Operating system error 2(The system cannot find the file specified.).


Source spid139
Message
Error: 18204, Severity: 16, State: 1.



And yet, the actual log dump appears fine and the file is found on the share. The dump is done with a maintenance plan.

Any ideas?

View 2 Replies View Related

Decimals Converting Back To Integers? What's Going On?

Feb 23, 2007

I am trying use the decimal data type for a field in SQL Server.  When I input the values below, they round off.
73.827 Rounds to 74
1925.1 Rounds to 1925
119.79 Rounds to 120
What am I missing?  Access never gave me this issue.  Do you see any reason this would happen? I am entering the values into the table directly!

View 5 Replies View Related

Handling Decimals In Creation Of Table

Sep 29, 2014

I have a table I am trying to create and one of the columns needs to have a decimal that appears as 00.00 and does not round because the data example is 87.09, 86.50, 98.55 etc. I have tried every type of decimal formatting when creating I can find and nothing has worked. When I create the table and upload the data it keeps rounding like this: 87.00, 87.00, 99.00

The only way it does not round is if I do it as a char but that does not seem right when dealing with numerics.

View 1 Replies View Related

What Functions To Manipulate Numbers And Decimals

Oct 15, 2006

what re the sql functions to manipulate numbers, decimals, dates..
1/ like if I have 123443.78654 I want to display just 2 decimals : 123443.78 or 3 decimals ..
2/ also if I want to have bankers rounding
3/ how about dates conversion : from string to date type and vice versa and adding dates, substracting dates, getting the day, the month....
what re the SQL functions to do that pls

View 4 Replies View Related







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