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 2005 Forums
 Transact-SQL (2005)
 HELP!!! select the updated record

Author  Topic 

hungleon88
Starting Member

16 Posts

Posted - 2008-07-30 : 08:09:21
how can i display the updated record ???
example :
update Toys
set UnitPrice = UnitPrice + 10 where UnitPrice > 20

how can i return the records are updated?
Help plzzz!!!

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-30 : 08:11:52

Select UnitPrice from Toys
Where UnitPrice > 20


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-30 : 08:23:28
Use the new OUTPUT operator.
See http://weblogs.sqlteam.com/peterl/archive/2007/10/03/New-OUTPUT-operator.aspx



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

hungleon88
Starting Member

16 Posts

Posted - 2008-07-30 : 08:23:47
sorry
the UnitPrice column have some records like:
20
10
15
30
5
after updated
20
20
25
30
15
how can i get record of 20(2) , 25,15 ???
Go to Top of Page

hungleon88
Starting Member

16 Posts

Posted - 2008-07-30 : 08:25:32
set UnitPrice where UnitPrice < 20 , soryyyyyyyyyyyyyyyyyyyyyyyyy

i have try :
update Toys
set UnitPrice = UnitPrice + 10
output inserted.UnitPrice

But i can't use where clause in UnitPrice + 10 (where UnitPrice <20)
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-30 : 08:41:15
Do you read the replies? All of them?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

hungleon88
Starting Member

16 Posts

Posted - 2008-07-30 : 08:47:06
quote:
Originally posted by Peso

Do you read the replies? All of them?

Yes....i read all

E 12°55'05.25"
N 56°04'39.16"


Go to Top of Page

hungleon88
Starting Member

16 Posts

Posted - 2008-07-30 : 08:56:59
oh thanks all for help, i found it!!

Go to Top of Page
   

- Advertisement -