Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 update query

Author  Topic 

desikankannan
Posting Yak Master

152 Posts

Posted - 2008-03-25 : 12:51:26
Hi,
i have 6 Records but i want to udpate only 3 records
below with scenario "update tblautogen set acitve= y where
ccode="G" BUT IT UPDATE ALL THE 6 RECORDS ACTIVE = Y BUT I NEED
UPDATE ONLY 3 RECORDS PLEASE GUIDE ME VERY VERY URGENT
ccode---couponno-----active
G-------5555555--------N
G-------4444444--------N
G-------6666666--------N
G-------2222222--------N
G-------DFDFFDF--------N

Desikankannan

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-03-25 : 12:54:53
Which 3 records?

You can use this:

Set Rowcount 3

update tblautogen set active= 'y' where
ccode=''

Set Rowcount 0



Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

desikankannan
Posting Yak Master

152 Posts

Posted - 2008-03-25 : 14:44:29
hi
iam doing this through .net there is not set rowcount concept
in .net



Desikankannan
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-03-25 : 15:27:21
Try:-
UPDATE t
SET t.Active='Y'
FROM
(SELECT TOP 3 t.field1,t.field2,... FROM Table where ccode='G')t
Go to Top of Page
   

- Advertisement -