Retrieve Multiple Roleid's by passing csv strings into a stored procedure

  • Dear All

    I have a table Roles with columns(RoleId,Rolename)

    I have another table userrole with columns(userid,roleid)

    I need to retrieve the roleids when rolenames(multiple strings in csv format) are passed to stored procedure.

    The stored procedure is as follows

    create procedure GetRoleIds(@Rolenames varchar(200),@RoleIds int output) as

    begin

    end

    declare @roleidlist int

    Exec GetRoleIds 'Admin,Manager,Developer',@roleidlist output

    print @roleidlist

    The output must be 1,2,3.

    Roles table data

    Roleid rolename

    1 Admin

    2 Manager

    3 Developer

    How to do this.Please help

    urgent

    Thanks

    srinivas

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply