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 |
|
pacastillo24
Starting Member
3 Posts |
Posted - 2008-01-30 : 12:29:03
|
| Hi,I am using this stored procedure in my program, but I want to know want is wrong with this;set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgoALTER PROCEDURE [dbo].[ObtenerMenuByRol]@rol varchar(50)ASSET NOCOUNT ON;SELECT ID, ParentID, Texto, URL, fechaCreacion, RolFROM TM0125WHERE (Rol In(@rol))@rol get this parameter 1 or 2 or 3but if I pass to this 1,2 from my code this has errors, anyone can give me some tips to solve this?if I copyUSE [Saig]GODECLARE @return_value intEXEC @return_value = [dbo].[ObtenerMenuByRol] @rol = '1','2'SELECT 'Return Value' = @return_valueGOthis says:Msg 119, Level 15, State 1, Line 4Must pass parameter number 2 and subsequent parameters as '@name = value'. After the form '@name = value' has been used, all subsequent parameters must be passed in the form '@name = value'.I dont know about transact sql only the basic.kind regards,Pablo |
|
|
pacastillo24
Starting Member
3 Posts |
|
|
tprupsis
Yak Posting Veteran
88 Posts |
|
|
pacastillo24
Starting Member
3 Posts |
Posted - 2008-01-30 : 17:48:41
|
uh theses solution are a little hard for a newbie same as me.I dont understand anything  |
 |
|
|
tprupsis
Yak Posting Veteran
88 Posts |
Posted - 2008-02-03 : 23:11:00
|
| The article provides the code for a SPLIT function. Create a function in your database called SPLIT using this code. Then, change your stored procedure from WHERE (Rol In(@rol))toWHERE (Rol In(SPLIT(@rol,',')))Then, when you call the procedure, pass the parameter as @rol = '1,2' |
 |
|
|
|
|
|
|
|