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.
Author |
Topic |
moramoga
Starting Member
34 Posts |
Posted - 2006-12-05 : 20:11:32
|
I have this procedureCREATE Procedure agregarUsuario @idUsuario varChar(20),@nombre varchar(20),@estado varChar(20),@fechaIngreso datetime,@email varchar(20),@tipo tinyint,@estacionIngreso varChar(20) ASDECLARE @password varchar(20)BEGIN TRANSET @password = @idUsuario + @emailINSERT INTO TUsuarioVALUES(@idUsuario,@password,@nombre,@estado,@fechaIngreso,@email,@tipo,@estacionIngreso)BEGINCOMMIT TRAN; RETURN 0 ENDBEGINROLLBACK TRAN; RETURN 1; ENDEXEC agregarUsuario '12345', 'juan', 'activo', 'July 29 1998 2:50 PM', 'blablab@hotmail.com', 1, 'maquina10'That function insert one user, but what I need here is a function that allows me to control the amount of times the Insert actually runs, based on a parameter sent to the procedure. How do I send this parameter (lets call it numOfUsers) at the time of execution, and how do I get the function to differentiate the many parameters it will receive? |
|
moramoga
Starting Member
34 Posts |
Posted - 2006-12-05 : 20:23:26
|
What I have to do is the same procedure at the one I posted, but it have to receive as a parameter the number of users that I want to register, and all the parameters necessary to insert a user... |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-12-05 : 23:34:23
|
Do you mean to say you will pass multiple user details along with @numofusers to the SP and loop in the SP to add those users?I will suggest run a loop from the front-end and pass single user details. Otherwise, if you are going to pass those details as CSV, refer this:[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=6134[/url]Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
moramoga
Starting Member
34 Posts |
Posted - 2006-12-06 : 19:25:35
|
I still dont get it how... |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-12-07 : 00:07:38
|
Did you read the suggested links?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|