(urgent)how Should I Treat Signed Decimal Values In Sql Server

Jul 30, 2007

Hi,

    I want to transfer the data from a excel spread sheet to sql server. I have used the oledb comand and it works fine, and i have also used the sqlbulkcopy and it transfers the data properly.

   But in my excel spread sheet i have many columns with data as -0.76 or 0.76 or something like that but when it transfer it to sqlserver  that particular column in sql server shows it as 0.00762711864406778

 So how i can i tell sql server to display the data as 0.76 instead of 0.00762711864406778

 

any help will be appreciated.

Regards

Karen

View 2 Replies


ADVERTISEMENT

(urgent)how Should I Treat Signed Decimal Values In Sql Server

Jul 30, 2007



Hi,

I want to transfer the data from a excel spread sheet to sql server. I have used the oledb comand and it works fine, and i have also used the sqlbulkcopy and it transfers the data properly.

But in my excel spread sheet i have many columns with data as -0.76 or 0.76 or something like that but when it transfer it to sqlserver that particular column in sql server shows it as 0.00762711864406778

So how i can i tell sql server to display the data as 0.76 instead of 0.00762711864406778



any help will be appreciated.

Regards

Karen

View 7 Replies View Related

Convert Character Representation Of A Signed Decimal

Apr 25, 2008

SQL/SERVER 2000:

Data transform task which copies data from a text file to a db table.

Text file field value = 0000000242E (signed decimal)

DB column data type = decimal(11,2)

How do I get this value correctly converted? Getting "invalid data value" error message.

thanks for any help

View 1 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

SQL Server 2012 :: Decimal Data Type Round Off The Values

Sep 11, 2014

I have table with data type decimal (18,2) when i try to load more then 2 decimal it is rounding off

Example 34.456 is rounded with 34.46

I want to store 34.45 only with out round in decimal data type how can i achive this

View 2 Replies View Related

SQL Server 2012 :: How To Trim Values If More Than 2 Numbers After Decimal Point

Jul 23, 2015

I am importing an excel spreadsheet into a MS SQL database table. When the spreadsheet is finished importing, I am noticing that some values that were brought in resemble something like this 1.41666666666667. Other values may be shorter or only have 1 digit. The problem is another web application that pulls this data for use in online forms only allows up to 2 digits. How can I round all of the numbers like the above to 2 decimals and replace the existing values?

I know there is the rounding function that could be used like so:

SELECT ROUND ([Hrs Total 2],2)
FROM AnnualClassifiedPAFs

How do I then take that rounded value and insert it back into the records?

View 2 Replies View Related

Integration Services :: SSIS Reads Nvarchar Values As Null When Excel Column Includes Decimal And String Values

Dec 9, 2013

I have SQL Server 2012 SSIS. I have Excel source and OLE DB Destination.I have problem with importing CustomerSales column.CustomerSales values like 1000.00,2000.10,3000.30,NotAvailable.So I have decimal values and nvarchar mixed in on Excel column. This is requirement for solution.However SSIS reads only numeric values correctly and nvarchar values are set as Null. Why?

CREATE TABLE [dbo].[Import_CustomerSales](
 [CustomerId] [nvarchar](50) NULL,
 [CustomeName] [nvarchar](50) NULL,
 [CustomerSales] [nvarchar](50) NULL
) ON [PRIMARY]

View 5 Replies View Related

How Can I Show One Decimal On Time (urgent)

Oct 15, 2007



I have a column in a table that has numbers. How can i convert my number from this 2.36 to 2.4
or
2.53 to 3.0

Thanks

View 6 Replies View Related

Storing Decimal Values

Aug 7, 2007

Hi,

I'm loading millions of rows into a database table. This data contains a lot of dedcimal values of 4 or 6 decimal places somtimes more.

I've found that storing them as floats is inaccurate, and I'm storing as decimals of the appropriate length.

I'm concerned whether this is the right way to do this ?

Can anyone make any suggestions, perhaps an article that I should take a look at ?


Sean

View 2 Replies View Related

Decimal Values Get Truncated When Using SqlDataReader In C# .net

Feb 17, 2004

The values that are being fetched from the database are not being read as is , when there are decimal values with 10 or more digits after the point, the values are truncated (approximated) to 8 digits

The approximation is not consistent in all the cases
Some times depending on the numbers for example 0.434000001 is truncated to 0.434.

This is happening when i read the values from the sql database using the SqlDataReader.GetValue method into an ArrayList in C# .NET

View 1 Replies View Related

Check If Varchar Has Non 0 Values In The Decimal?

Apr 25, 2008

Hi All,

I have a table Saleshistory with 89481412 records. I have a field Sales of nvarchar type, all the records in this field are numeric, and the records are with 2 decimal places. I expect all the records to be ending at .00 (for example 5.00,345.00,25.00), but I want to verify if something is for example 5.6 etc.

So in short I want to check if any Salesrecords have more than zero values in the decimal. How can I check this.

Please help.

Thanks,

Zee

View 8 Replies View Related

Decimal Places On Money Values

Sep 6, 2007

Hi

I have an SQL search that is converting two values to type money. I want it to show two digits after the decimal point but am getting inconsistent results. The first value is as follows:

tblInventoryItem.itemcost as originalcost (the column is datatype money)

This displays correctly i.e. 2000.00 or 150.70 etc

The second value is this:

tblInventoryItem.itemcost + tblUpgrades.ItemCost as totalcostincupgr (both columns are datatype money)

But this displays as 2000 or 150.7

How can I get the second value to show two decimal places even when the digits are zeros?

Thanks!

View 3 Replies View Related

Problem Converting Decimal Values

Apr 25, 2007

Hi. I I'm importing a text file with lot's of decimal values with this format xx.xx. The problem is that my locale is Portugal and the points are being striped off and are not being considered as decimal separators (for example I have values like 0.04 and in the sql server database i see 4). I have tried to change the locale but i receive a message saying that the locale is not installed in my system.

Any help on this ? tnks in advance

View 5 Replies View Related

How To Know If A Column In A Table Has Decimal Values

Apr 4, 2008



Hi Guys,

I want to find out if a ceratin column has values with decimal figures populated? for example say column A has values

10.00
20.00
30.00
50.01

in this case the query should let me know that there is one figure (50.01) with a actual decimal value. So the results of the query should be 1 (since one record has decimal figures <>.00)

Cananyone help

Sonny

View 10 Replies View Related

T-SQL (SS2K8) :: Display Values Up To 1 Decimal Without Function?

Sep 11, 2014

I am having values as below:

99.87
99.96
8.67

And my output should be as:

99.8
99.9
8.6

How can I do this

View 9 Replies View Related

Treat Contiguous Records As 1

Jul 23, 2005

Hi,How can I treat multiple, contiguous records as one record?i.e.,tblData(a varchar,t datetime)select * from tblDataorder by a,tthen, for row n, if a(n) = a(n+1) and t(n) <= t(n+1) (seconds) thentreat record n as the same as n+1, discard record n+1 and continue,else start again with the next row.Anyone got an idea? Just writing this I'm thinking I'm going to haveto venture into cursor territory (new for me).TIAChandy

View 1 Replies View Related

How To Treat Truncations As A Warning

May 16, 2007

I'm using SSIS to migrate data from one system to another. This is a usual extract, transform, cleanse and load type task.



The error handling is critical to get right. E.g. truncation of data on one column should stop that row being loaded but for other columns I might be happy to carry on loading the row but record a warning.



I'm finding the error disposition a bit limiting. I really feel the need for an 'Issue Warning' disposition which will act the same way as 'Ignore Error' in that the row continues being processed but will in addition copy a row to a warning output so that I can write a message to a log file for someone to manually investigate and correct that item of data post the conversion. Alternatively it would be useful to specify a severity (at a column level) when redirecting error output. This way I can put logic into a downstream component which would treat the error row differently depending on the severity of the error.



Am I missing a trick?

View 4 Replies View Related

Computer Generates Wrong Answer Of Decimal Values

Feb 23, 2008

hi, i'm using the following code to generate the value of a column in a database, where the colums value is dependent upon the multiplication of two other cells in the same row. When I execute the statement, it will work fine for whole numbers, but it does not work correctly for decimal values. All columns are of type varchar(50). An exmple.................It just multiplied 200 by 2.50 and returned 600SqlCommand objCmd2 = new SqlCommand("UPDATE Portfolio SET Current_Worth=Current_Price*Number_Of_Shares WHERE Name_Of_Asset LIKE '%'+@Name_Of_Asset+'%'", objConn);objCmd2.Parameters.AddWithValue("@Name_Of_Asset", DropDownList1.SelectedValue);objConn.Open();objCmd2.ExecuteNonQuery();objConn.Close(); Any ideas? 

View 5 Replies View Related

Single String Replace Logic - 0 Needs To Be Ignored For Decimal Values

May 10, 2012

The string column value looks like as below. Each value has a size of 15 withing a string

'2.2020 30 4.0000'

The column value should match with user input as below. The result should show equal when it is compared. Currently, it results not equal since it is a string comparision. The last digit '0' needs to be ignored for decimal values.

'2.202 30 4.0'

I need to handle the decimal values in such a way, if staring value with '.' and last digit is 0 then replace with space ''. So, it should look like

'2 2 2 30 4 ' = '2 2 2 30 4 '

When this string is compared, it results in EQUAL.

I tried the below logic, which even replaces the integer value like 30 to 3 and 3000 to 3 and results in equal which is incorrect.

RTRIM(REPLACE(REPLACE(RT1.rate,'''+@DOT+''','''+@S PACE+'''), '''+@ZERO+''', '''+@SPACE+''')) = '''+REPLACE(REPLACE(@Rate,'.',' '), '0', ' ')+''' '
Ex:'2.2020 300 4.00' = '2.20200 30 4.0'

After replace, string looks like

Ex:'2 2 2 3 4 ' = '2 2 2 3 4 '

It results as EQUAL which is incorrect. I need only decimal value to be replaced not integer.

I am looking for a single string replace logic.

View 3 Replies View Related

Transact SQL :: Values In Table - Convert Varchar To Decimal

Jul 22, 2015

I have one of the sample values in my table. I need to convert below value to Decimal(18,5)

DECLARE @i
VARCHAR
SET @i
= '0.9'

Output i m looking for is 0.90000

View 16 Replies View Related

Reporting Services :: Display Only Two Values Before Decimal Points

Sep 24, 2015

In my report I am having one calculation filed, in that field I want to display only two values before decimal point.

For example, if I am having calculation field value as 3456.54, I need to display as 35.54 or 34.54.

View 3 Replies View Related

Treat Data Differently For Positive Vs Negative #

Oct 11, 2005

Ok, I have a table with IP addresses stored in decimal format using both positive and negative numbers.
The way that they are stored is:
Positve
1 thru 2147483647 = 0.0.0.1 - 127.255.255.255
Negative
-2147483648 thru -1 = 128.0.0.0 - 255.255.255.255
Conversion
positive
x/2^24 . (x/2^24)/2^16 . etc . etc
negative
(x+2^32)/2^24 . ((x+2^32)/2^24)/2^16 . etc . etc

I have a script which works by using UNION and the WHERE statements are x>0 x<0

My problem is I need to use a 3rd party app to run the script (McAfee ePO). McAfee does not recognize the UNION. My question is, can I acheive the same results as the script below, without using UNION.

SELECT ReportFullPathNode.FullPathName,
cast(cast(IPSubnetMask.IP_Start as bigint)/16777216 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_Start as bigint)%16777216/65536 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_Start as bigint)%16777216%65536/256 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_Start as bigint)%16777216%65536%256 as varchar),
cast(cast(IPSubnetMask.IP_End as bigint)/16777216 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_End as bigint)%16777216/65536 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_End as bigint)%16777216%65536/256 as varchar) + '.' +
cast(cast(IPSubnetMask.IP_End as bigint)%16777216%65536%256 as varchar),
cast(IPSubnetMask.LeftMostBits as varchar),
IPSubnetMask.IP_Start
FROM IPSubnetMask, ReportFullPathNode ReportFullPathNode
WHERE IPSubnetMask.IP_Start>0 and IPSubnetMask.ParentID = ReportFullPathNode.LowestNodeID
UNION ALL
SELECT ReportFullPathNode.FullPathName,
cast(cast(4294967296+IPSubnetMask.IP_Start as bigint)/16777216 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_Start as bigint)%16777216/65536 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_Start as bigint)%16777216%65536/256 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_Start as bigint)%16777216%65536%256 as varchar),
cast(cast(4294967296+IPSubnetMask.IP_End as bigint)/16777216 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_End as bigint)%16777216/65536 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_End as bigint)%16777216%65536/256 as varchar) + '.' +
cast(cast(4294967296+IPSubnetMask.IP_End as bigint)%16777216%65536%256 as varchar),
cast(IPSubnetMask.LeftMostBits as varchar),
IPSubnetMask.IP_Start+4294967296
FROM IPSubnetMask, ReportFullPathNode ReportFullPathNode
WHERE IPSubnetMask.IP_Start<0 and IPSubnetMask.ParentID = ReportFullPathNode.LowestNodeID

View 2 Replies View Related

Self-Signed Certificate

Mar 10, 2006

Can anybody can tell me how to do self-signed certificate on sql server? What is it ? Do we really need?
Many thanks.

View 12 Replies View Related

How To Add A Signed CLR Assembly

Aug 30, 2012

I'm trying to add an assembly to my SSDT project, and in my assembly, it requires EXTERNAL access, which also means that the assembly has to be signed, and an asymmetric key must be created from the assembly.  I can't figure out how to get this to work from the SSDT project.

View 8 Replies View Related

Problem With Encryption Using Self-signed SSL Cert

Apr 21, 2008

Hello,

I have a SQL 2005 test system set up that I need to test with protocol encryption, and had in mind to peform this test using a self-signed SSL certificate. I have read the guides and requirements from MS as well as the few blogs I could find on the subject and I've *almost* gotten it to work, but I'm failing at what seems to be the last step - getting clients to connect.. Here is what I've done:

-Created a self-signed certificate (I've tried using SSL Diagnostics from the IIS Diagnostics package, makecert.exe from .NET SDK, and OpenSSL) with the 'Server Authentication' purpose, with a CN that matches the server name, along with a private key. I've imported the cert in the local computer's personal store (also in LC's Trusted Root).
-SQL Server Configuration Manager sees the certificate and allows selecting it in the configuration. I've done this and selected 'Force Encryption' in the protocol settings.
-Restarted SQL Server, errorlog says 'The certificate was sucessfully loaded for encryption'.
-Tried connecting locally using SSMS and setting encryption: No problem.
-Exported the cert from the store and imported it into the LC's Trusted Root store on the client comp.

Here's where the problems begin.
1: Client is still apparently able to connect *unencrypted* to the SQL Server (I tested with SSMS on the client machine, it states under connection properties that the conn is not encrypted)

2: When trying to connect encrypted, SSMS returns an error during the pre-login handshake saying "The certificate's CN name does not match the passed value." When using the same cert in IIS there are no problems whatsoever, and the CN in the cert does indeed match the server name so I'm thinking the real error is hiding beneath the one that is thrown.

Also tried to configure the SQL Client Network Utility to force encryption from the client side, but this didn't seem to have any effect. I tried to use Network Monitor to capture network traffic, but since it appears to be encrypted (SQL encrypts login handshake anyway afaik) I couldn't get much out of it.. Does anyone have any tips?

View 2 Replies View Related

How To Determine Objects Signed By A Certificate

Apr 30, 2007

Is there any way to determine what objects (stored procedures in my case) have been signed by a certificate? I could not find any system views/tables/functions that seem to give any information about certificates what so ever. Am I missing something or is that part of the security to prevent gaining details about certificate usage?

View 5 Replies View Related

Load Multiple Signed Assemblies

Aug 18, 2006

I am trying to load multiple strongly named assemblies into the same database which are signed with the same .snk file (signed in Visual Studio).  I use the following code to create an asymmetric key and login as Books Online recommends:

CREATE ASYMMETRIC KEY SQLCLRKey FROM FILE = 'D:dbainAssembly.dll'

CREATE LOGIN CLRAssembler FROM ASYMMETRIC KEY SQLCLRKey

 GRANT UNSAFE ASSEMBLY TO CLRAssembler

GRANT EXTERNAL ACCESS ASSEMBLY TO CLRAssembler

REVOKE CONNECT SQL FROM CLRAssembler

Do I need to create a new login and asymmetric key for each assembly I load?  If so, do I need to sign each with a different key because its giving me an error message when I try to create 2 separate asymmetric keys/logins from 2 different assemblies which have been signed with the same .snk file.

The only way I've gotten everything to load properly is to create a separate key for each assembly and sign each, then create separate logins and asymmetric keys in the database.

Is this the only way to do this?  Or am I missing something?

View 5 Replies View Related

Problem Importing A Signed Number

Apr 9, 2008

I have a flat file that contains 20.00- value and I am trying to import it into a decimal field and it does not like the sign. What do I need to do to convert this via SSIS? Thank you

View 1 Replies View Related

Can't Read Values That Are Less Than Zero!!!????(urgent)

Oct 10, 2007


I am having a very weird problem.
I have the following expression
=Val(Fields!test.Value)
This will display the number if the number is greater than 0.
So it will display any number above 0 and it won€™t display .05
Or .75 any idea?


Thanks

View 4 Replies View Related

Duplicate Values In A Column.....URGENT!!

May 9, 2000

We have a table with 1 million rows with duplicates in a column which allows nulls.Can we enforce uniqueness for only future inserts by anyway(ignoring the old ones)?
Thanks!

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

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







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