|
While technically correct, it's bad practice. That's why I've voted you down.
|
|
|
|
|
Yes. you are right.
I know this is bad practice.
Regards
KP
|
|
|
|
|
Hallo all
I'm having a problem with some data that I've taken from SQL and copied into an Excel spreadsheet.
Please try this and type the following into these cells:
A1 : -982.21
B1 : 908.66
C1 : -73.55
D1 : =IF(A1+B1=C1,"Correct","Incorrect")
D1 shows "incorrect" which doesn't make sense since A1 + B1 does equal C1. This happens on a couple of rows, I've checked and they should show correct. I have also tried using the SUM function instead of adding A1+B1 and I even tried (IF C1-B1=A1) but it didn't work either. I have formatted the columns as decimal numbers.
Am I missing something really simple here?
Any clues would be appreciated
Thanks
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
Rounding errors in the calculation are probably the cause. I'd imagine that excel uses decimal numeric type because it is used so much for financial calculations, while the FLOAT type in the database is just that.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
I think you're right.
I used the SUM function on -982.21 and 908.66.
I then increased the decimal places on the answer cell to 25 and I saw this
-73.5500000000001000000000000
The previous values don't have anything after their first 2 decimal places so I don't know where that 1 is coming from. Will make a plan though.
Thanks for your help
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
If you haven't solved it already - Try:
=IF(ROUND(A1+B1-C1,5)=0,"Correct","Incorrect")
|
|
|
|
|
Thanks, I already made SQL do the decision and that works. I tried your formula though and it works great.
Thanks
Scott
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
guys again I am throwing you the question
salary
====
1000
2000
3000
4000
4500
1500
here i want to show the max value of two records
means want to show 4500 and 4000
how to do that
plz tell me the query
i need urgently...
Magi
|
|
|
|
|
hi,
first read all the values in a vector and the use array.sort(vector) .
then you can take the values.
hope this help.
|
|
|
|
|
Are you sure you can do that? I've never seen anything like that in SQL.
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
Use the TOP keyword like so:
SELECT TOP 2 salary FROM tablename
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
smyers wrote: SELECT TOP 2 salary FROM tablename
I think you need to sort it in descending order to get the result what author expected
|
|
|
|
|
Don't lie, you just made that up.
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
smyers wrote: Don't lie, you just made that up.
|
|
|
|
|
SELECT TOP 2 Salary FROM TableName ORDER BY Salary DESC
|
|
|
|
|
use
SELECT TOP 2* Salary FROM TableName ORDER BY Salary DESC
Sathiya
|
|
|
|
|
Hi,
There is sqlserver 2005 installed in my machine. but i am not able to find the northwind database in the management studio . Can anybody help me to find this database. should i install any addiotional files to get northwind database.
Thanks in advance
Sebastian
|
|
|
|
|
You need to download them from microsoft's site.
Northwind is for 2000 and whilst it works on 2005 AdventureWorks is the sample designed from 2005 and is the recommended sample.
Northwind[^]
AdventureWorks[^]
|
|
|
|
|
Thank you very much .
sebastian
|
|
|
|
|
no problem
|
|
|
|
|
Hi All,
I have two datatables, one datatable named "dtRecords1" gets filled from excel sheet, having column name "Name","Category", and on run time i have added a Identity column to "dtRecords1".
Second Column gets filled from sql server database having three columsn "ID as Identity","Name","Category".
Now i want to merge these two tables, i want this result from merge.
If there are some changes in first datatable, depending upon all columns (comparing all column values) and ID Is same,it should be overwrited, and if there are some new rows these also should be added to the resulted database.
Example:
Datatable1 from excel
ID,Name,Categoey
1,adnan,SE
2,ali,SSE
3,Imran,JSE
Datatable2 From SQL Server DB
ID,Name,Category
1,adnan,SSE
2,ali,SSE
Resulted Datatable
ID,Name,Category
1,adnan,SE -Changed ROw
2,ali,SSE -Unchanged Row
3,Imran,JSE - Newly added Row
Many THanks & Best Regards,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
I don't think there is a merge method in the DataTable class, there is in DataSet though if all else fails.
I'm sure you could use importrow though like so:
for (int x = 0; x < datatable2.Rows.Count; x++)
{
datatable1.ImportRow(datatable2.Rows[x])
}
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
I am 100% sure there is method merge in datatable, when i create instance of datatable, press dot, you will also see, merge method.
Will you please help to fullfill the requirment that i have asked in question or explain what you have in this loop.
Many Thanks,
adnna
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
Sorry, I didn't check.
Google datatable.merge
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
I have search many newsgroup on the world. No one know is there are any driver availible. My ASP.Net 2 project now cannot run properly on x64 system on exporting data to Excel format.
Is it no way to use OLEDB in the future? No solution to fix my problem?
|
|
|
|