 |
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

July 6th, 2004, 04:01 PM
|
Registered User
|
|
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Round
Hi All,
please see the following
UPDATE Employee
SET
salary = round(salary ,0),
incentive = round(incentive,0),
bonus = round(bonus,0),
expense = round(expense ,0)
where
empid = 23
When i am executing the above query it shows like following?
0 row(s) affected
0 row(s) affected
If i am giving more than two columns in the update statement then I am getting like above
why it is so? Is there anything wrong with my query?
Please help me out.
Thanks in advance.
|

July 6th, 2004, 04:38 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Can you check this and let me know if you see any records existing for empid = 23
Code:
select * from Employee where empid = 23
Cheers!
_________________________
- Vijay G
Strive for Perfection
|

July 6th, 2004, 04:43 PM
|
Registered User
|
|
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
select * from Employee where empid = 23
returns 0 rows, (Is this the reason why I am getting that message?)
but I may have to update when the empid exists.
|

July 6th, 2004, 04:58 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Yes, you don't have any records with empid=23, so you are trying to update values of a non-exisiting records, that is why you see 0 rows affected.
You can check other records for empid's value and try updating that.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|

July 6th, 2004, 05:08 PM
|
Registered User
|
|
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the information Vijay.
Is it the same reason why i am seeing 0 row(s) affected TWICE like following when I execute the above update query with no records exisits in DB?
0 row(s) affected
0 row(s) affected
Thanks bunch
|

July 6th, 2004, 05:13 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
But I am not sure, why you are seeing it TWICE. You should be seeing that only once.  , though record does not exist that satisfying your WHERE clause, unless you are executing any other statements along with UPDATE as a batch
Cheers!
_________________________
- Vijay G
Strive for Perfection
|

July 7th, 2004, 01:11 AM
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Dear Paul_T , Vijay is right you can only update those record which are already exists in the data base
:)
cheers
Love 4 all
|

July 7th, 2004, 02:37 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Paul_T,
Actually you should be seeing The command(s) completed successfully. when you try to update rows that really don't satisfy the criteria in WHERE clause.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
Round() |
kingroon |
Classic ASP Basics |
1 |
September 15th, 2008 01:17 PM |
asp round |
crmpicco |
Classic ASP Basics |
3 |
June 6th, 2005 08:47 AM |
round (again) |
crmpicco |
Classic ASP Basics |
1 |
March 17th, 2005 08:14 AM |
Query Round up |
Freddyfred |
Access |
1 |
December 17th, 2004 09:49 AM |
round function help |
mohiddin52 |
Access |
2 |
October 21st, 2004 07:14 AM |
|
 |