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)
 change already stored data

Author  Topic 

perinbarajan
Starting Member

2 Posts

Posted - 2010-09-14 : 02:26:33
hai i have a table name called employee which has 3 fields like eid,fname,lname. but all values in fname are same. i want to change each and every value as unique name. how can i do that?

this is my table

eid fname lname
1 dsfds dfd
100 dsfds dfd
50 dsfds dfd
25 dsfds dfd
16 dsfds dfd
14 dsfds dfd
100 dsfds dfd
50 dsfds dfd
25 dsfds dfd
16 dsfds dfd
14 dsfds dfd

Sachin.Nand

2937 Posts

Posted - 2010-09-14 : 02:30:27
How do you decide on what will be your unique name?


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

perinbarajan
Starting Member

2 Posts

Posted - 2010-09-14 : 02:35:39
hi thnx for ur reply

i dont want to specify any name. each and every name sholud be different as per ur needs like kumar,suresh. here i want single query to change all values as unique name. is there any possibilities

for example

fname
suresh
kumar
vel
peter

like this .

Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-09-14 : 04:47:46
Maybe this

select fname + '' + row_number()over(order by (select 1)) from yourtable


It will append a unique number to fname.So fname becomes fname1,fname2,fname3 and so on.....


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page
   

- Advertisement -