0

Hi,

I have 20 rows in a table and I want to update 10 of them only.

I am using MS SQL.

Any ideas please.

Cheers

Edited by Red_Indian: n/a

5
Contributors
6
Replies
10
Views
7 Years
Discussion Span
Last Post by prit005
0

use below procedure
---------------------------


USE testtable;
GO
UPDATE testtable.Employee
SET salary=salary+1000
WHERE Sal>=5000 and sal<=15000
IF @@ROWCOUNT = 10
PRINT 'Count limit is reached.';
GO

0

Thanks for the suggestion.

There are 3 columns. But as you know the very first column is nameless and numbers each row. I cannot use a any of the columns to set a condition e.g. if col1 < 'value1' and > 'value2'. I just want to be able to update 2 columns values up to 10 rows.

Hope that makes sense.

Thanks for the help

0

Cheers.

Can you use the IF @@ROWCOUNT = 10 without the WHERE condition?

-1

Update EMPLOYEE set EMPNAME='SomeValue' where EMPID in(1,2,3,4,5,6,7,8,9,10)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.