Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello, I have a problem in update a column in sql server 2005, I want update a column in which column password have same password for every entry. i want update this column for auto genrate string, by which every one have different password, can any one suggest me how can i do it.what will be procedure , can any one tel me about the query.
Thanks in advance
Posted

you can use identity column in sql server 2005
like this

colname identity(1,1) in your table declaration
 
Share this answer
 
Comments
ManavGuru 25-Apr-12 1:19am    
can u write some code?
SQL
create table nameoftable
(AutogeneratedIdColName int identity(1,1) , restof columns of your table)
 
Share this answer
 
hi you can use this,
SQL
update tablename set passwordcolumn=passwordcolumn+ cast(uridentycolumn as varchar(10))

where passwordcolumn   in
( select passwordcolumn from tablename
group by passwordcolumn
having count(*) > 1 )
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900