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)
 updating a column depending on other columns of same table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-01-24 : 08:30:48
anil writes "i have table with the following columns.
id,type, code, newcode.
i need to update newcode column depending on type and code values.

1) if i have two rows with same code value and different type then the newcode is set to A.
2) if i have two rows with same code value and same type then the newcode is set to B.
3)if i have more than two rows with same code value then the newcode is set to C.

How can i do this in a stored procedure"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-24 : 08:50:35
Post sample data and the result you want

Madhivanan

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

- Advertisement -