Author |
Topic |
Pasi
Posting Yak Master
166 Posts |
Posted - 2014-05-28 : 18:25:10
|
HI,I am trying to use a first_name , Last_name and append this as username something like mike test and create username like 'Mtest@123'. and password as well. The first_name, last_name comes from a table called "person".Right now the user name and password is hard coded and I need to make this dynamically generated, is that possible within SQL?How can I do this within SP? Below is my sp which Tara helped: (thanks Tara).ALter PROCEDURE PatientEnroll (@person_id AS uniqueidentifier)AS BEGINSET NOCOUNT ONINSERT INTO dbo.ngweb_bulk_enrollments(row_id, person_id,practice_id, user_name,password,security_answer,forgot_password_question,forgot_password_answer,created_by,create_timestamp,modified_by,modified_timestamp)--SELECT newid(),p.person_id,'0001','gbile','ABc23','Red','color','Red',[user_id],current_timestamp,'',current_timestampfrom person pinner join user_mstr um on um.practice_id=p.practice_idinner join nxmd_demographics_ nd on nd.person_id= p.person_idinner join patient_encounter pe on pe.person_id =nd.person_idinner join patient d on d.person_id =p.person_idwhere p.person_id =@person_idand email_address <>''ENDGO |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-05-28 : 19:27:46
|
SELECT newid(),p.person_id,'0001',first_name+last_name,first_name+last_name+'123','Red','color','Red',[user_id],current_timestamp,'',current_timestampTara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
 |
|
Pasi
Posting Yak Master
166 Posts |
Posted - 2014-05-28 : 19:54:47
|
Thanks Tara.!quote: Originally posted by tkizer SELECT newid(),p.person_id,'0001',first_name+last_name,first_name+last_name+'123','Red','color','Red',[user_id],current_timestamp,'',current_timestampTara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/
|
 |
|
|
|
|