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
 SQL Server Development (2000)
 inserting identity columns value in another column

Author  Topic 

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-05-29 : 03:36:37
Hi all,

My table is

userid username
1 user1
2 user2
..

Here Userid is primarykey and auto increment, username is unique key

how i write the insert statement to insert into my table with appending 'user'??

Help me!


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-05-29 : 03:38:36
[code]
insert into yourtable(username) values (@username)
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-05-29 : 04:35:02
sorry khtan,

I can't understand your answer, I want to generate Username like user1,user2,..

where 1,2... are userid


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-05-29 : 05:19:31
[code]
select username = 'user' + convert(varchar(10), userid)
from yourtable
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-05-29 : 05:28:15
Refer this

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=57069



Madhivanan

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

- Advertisement -