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
 Old Forums
 CLOSED - General SQL Server
 function

Author  Topic 

mateenmohd
Constraint Violating Yak Guru

297 Posts

Posted - 2007-05-26 : 09:57:27
what function will use to add P in the user_id data ?


user_id type varchar

ie.
user_id
--------
012345
014153
016464
...

add P before the user_id i.e.

user_id
--------
p012345
p014153
p016464
...

regards
Mateen

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-26 : 10:34:11
update YourTabel
set user_id = 'p' + user_id

if this causes a truncation of some data you'll have to increase the column length first.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-26 : 10:40:25
Alternatively, you can add that when selecting data

Select 'p'+user_id as user_id from table

Madhivanan

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

mateenmohd
Constraint Violating Yak Guru

297 Posts

Posted - 2007-05-26 : 10:43:07
thanks you very much.
Go to Top of Page
   

- Advertisement -